FFmpeg
stdbit.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2023 RĂ©mi Denis-Courmont
3  *
4  * This program is free software; you can redistribute it and/or modify it
5  * under the terms of the GNU Lesser General Public License as published by
6  * the Free Software Foundation; either version 2.1 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public License
15  * along with this program; if not, write to the Free Software Foundation,
16  * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
17  */
18 
19 #ifndef __STDC_VERSION_STDBIT_H__
20 #define __STDC_VERSION_STDBIT_H__ 202311L
21 
22 #include <stdbool.h>
23 #include <limits.h> /* CHAR_BIT */
24 
25 #define __STDC_ENDIAN_LITTLE__ 1234
26 #define __STDC_ENDIAN_BIG__ 4321
27 
28 #ifdef __BYTE_ORDER__
29 # if (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)
30 # define __STDC_ENDIAN_NATIVE__ __STDC_ENDIAN_LITTLE__
31 # elif (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__)
32 # define __STDC_ENDIAN_NATIVE__ __STDC_ENDIAN_BIG__
33 # else
34 # define __STDC_ENDIAN_NATIVE__ 3412
35 # endif
36 #elif defined(_MSC_VER)
37 # define __STDC_ENDIAN_NATIVE__ __STDC_ENDIAN_LITTLE__
38 #else
39 # error Not implemented.
40 #endif
41 
42 #define __stdbit_generic_type_func(func, value) \
43  _Generic (value, \
44  unsigned long long: stdc_##func##_ull((unsigned long long)(value)), \
45  unsigned long: stdc_##func##_ul((unsigned long)(value)), \
46  unsigned int: stdc_##func##_ui((unsigned int)(value)), \
47  unsigned short: stdc_##func##_us((unsigned short)(value)), \
48  unsigned char: stdc_##func##_uc((unsigned char)(value)))
49 
50 #if defined (__GNUC__) || defined (__clang__)
51 static inline unsigned int stdc_leading_zeros_ull(unsigned long long value)
52 {
53  return value ? __builtin_clzll(value) : (CHAR_BIT * sizeof (value));
54 }
55 
56 static inline unsigned int stdc_leading_zeros_ul(unsigned long value)
57 {
58  return value ? __builtin_clzl(value) : (CHAR_BIT * sizeof (value));
59 }
60 
61 static inline unsigned int stdc_leading_zeros_ui(unsigned int value)
62 {
63  return value ? __builtin_clz(value) : (CHAR_BIT * sizeof (value));
64 }
65 
66 static inline unsigned int stdc_leading_zeros_us(unsigned short value)
67 {
69  - CHAR_BIT * (sizeof (int) - sizeof (value));
70 }
71 
72 static inline unsigned int stdc_leading_zeros_uc(unsigned char value)
73 {
74  return stdc_leading_zeros_ui(value) - (CHAR_BIT * (sizeof (int) - 1));
75 }
76 #else
77 static inline unsigned int __stdc_leading_zeros(unsigned long long value,
78  unsigned int size)
79 {
80  unsigned int zeros = size * CHAR_BIT;
81 
82  while (value != 0) {
83  value >>= 1;
84  zeros--;
85  }
86 
87  return zeros;
88 }
89 
90 static inline unsigned int stdc_leading_zeros_ull(unsigned long long value)
91 {
92  return __stdc_leading_zeros(value, sizeof (value));
93 }
94 
95 static inline unsigned int stdc_leading_zeros_ul(unsigned long value)
96 {
97  return __stdc_leading_zeros(value, sizeof (value));
98 }
99 
100 static inline unsigned int stdc_leading_zeros_ui(unsigned int value)
101 {
102  return __stdc_leading_zeros(value, sizeof (value));
103 }
104 
105 static inline unsigned int stdc_leading_zeros_us(unsigned short value)
106 {
107  return __stdc_leading_zeros(value, sizeof (value));
108 }
109 
110 static inline unsigned int stdc_leading_zeros_uc(unsigned char value)
111 {
112  return __stdc_leading_zeros(value, sizeof (value));
113 }
114 #endif
115 
116 #define stdc_leading_zeros(value) \
117  __stdbit_generic_type_func(leading_zeros, value)
118 
119 static inline unsigned int stdc_leading_ones_ull(unsigned long long value)
120 {
121  return stdc_leading_zeros_ull(~value);
122 }
123 
124 static inline unsigned int stdc_leading_ones_ul(unsigned long value)
125 {
126  return stdc_leading_zeros_ul(~value);
127 }
128 
129 static inline unsigned int stdc_leading_ones_ui(unsigned int value)
130 {
131  return stdc_leading_zeros_ui(~value);
132 }
133 
134 static inline unsigned int stdc_leading_ones_us(unsigned short value)
135 {
136  return stdc_leading_zeros_us(~value);
137 }
138 
139 static inline unsigned int stdc_leading_ones_uc(unsigned char value)
140 {
141  return stdc_leading_zeros_uc(~value);
142 }
143 
144 #define stdc_leading_ones(value) \
145  __stdbit_generic_type_func(leading_ones, value)
146 
147 #if defined (__GNUC__) || defined (__clang__)
148 static inline unsigned int stdc_trailing_zeros_ull(unsigned long long value)
149 {
150  return value ? (unsigned int)__builtin_ctzll(value)
151  : (CHAR_BIT * sizeof (value));
152 }
153 
154 static inline unsigned int stdc_trailing_zeros_ul(unsigned long value)
155 {
156  return value ? (unsigned int)__builtin_ctzl(value)
157  : (CHAR_BIT * sizeof (value));
158 }
159 
160 static inline unsigned int stdc_trailing_zeros_ui(unsigned int value)
161 {
162  return value ? (unsigned int)__builtin_ctz(value)
163  : (CHAR_BIT * sizeof (value));
164 }
165 
166 static inline unsigned int stdc_trailing_zeros_us(unsigned short value)
167 {
168  return value ? (unsigned int)__builtin_ctz(value)
169  : (CHAR_BIT * sizeof (value));
170 }
171 
172 static inline unsigned int stdc_trailing_zeros_uc(unsigned char value)
173 {
174  return value ? (unsigned int)__builtin_ctz(value)
175  : (CHAR_BIT * sizeof (value));
176 }
177 #else
178 static inline unsigned int __stdc_trailing_zeros(unsigned long long value,
179  unsigned int size)
180 {
181  unsigned int zeros = 0;
182 
183  if (!value)
184  return size * CHAR_BIT;
185 
186  while ((value & 1) == 0) {
187  value >>= 1;
188  zeros++;
189  }
190 
191  return zeros;
192 }
193 
194 static inline unsigned int stdc_trailing_zeros_ull(unsigned long long value)
195 {
196  return __stdc_trailing_zeros(value, sizeof (value));
197 }
198 
199 static inline unsigned int stdc_trailing_zeros_ul(unsigned long value)
200 {
201  return __stdc_trailing_zeros(value, sizeof (value));
202 }
203 
204 static inline unsigned int stdc_trailing_zeros_ui(unsigned int value)
205 {
206  return __stdc_trailing_zeros(value, sizeof (value));
207 }
208 
209 static inline unsigned int stdc_trailing_zeros_us(unsigned short value)
210 {
211  return __stdc_trailing_zeros(value, sizeof (value));
212 }
213 
214 static inline unsigned int stdc_trailing_zeros_uc(unsigned char value)
215 {
216  return __stdc_trailing_zeros(value, sizeof (value));
217 }
218 #endif
219 
220 #define stdc_trailing_zeros(value) \
221  __stdbit_generic_type_func(trailing_zeros, value)
222 
223 static inline unsigned int stdc_trailing_ones_ull(unsigned long long value)
224 {
226 }
227 
228 static inline unsigned int stdc_trailing_ones_ul(unsigned long value)
229 {
230  return stdc_trailing_zeros_ul(~value);
231 }
232 
233 static inline unsigned int stdc_trailing_ones_ui(unsigned int value)
234 {
235  return stdc_trailing_zeros_ui(~value);
236 }
237 
238 static inline unsigned int stdc_trailing_ones_us(unsigned short value)
239 {
240  return stdc_trailing_zeros_us(~value);
241 }
242 
243 static inline unsigned int stdc_trailing_ones_uc(unsigned char value)
244 {
245  return stdc_trailing_zeros_uc(~value);
246 }
247 
248 #define stdc_trailing_ones(value) \
249  __stdbit_generic_type_func(trailing_ones, value)
250 
251 static inline unsigned int stdc_first_leading_one_ull(unsigned long long value)
252 {
253  return value ? (stdc_leading_zeros_ull(value) + 1) : 0;
254 }
255 
256 static inline unsigned int stdc_first_leading_one_ul(unsigned long value)
257 {
258  return value ? (stdc_leading_zeros_ul(value) + 1) : 0;
259 }
260 
261 static inline unsigned int stdc_first_leading_one_ui(unsigned int value)
262 {
263  return value ? (stdc_leading_zeros_ui(value) + 1) : 0;
264 }
265 
266 static inline unsigned int stdc_first_leading_one_us(unsigned short value)
267 {
268  return value ? (stdc_leading_zeros_us(value) + 1) : 0;
269 }
270 
271 static inline unsigned int stdc_first_leading_one_uc(unsigned char value)
272 {
273  return value ? (stdc_leading_zeros_uc(value) + 1) : 0;
274 }
275 
276 #define stdc_first_leading_one(value) \
277  __stdbit_generic_type_func(first_leading_one, value)
278 
279 static inline unsigned int stdc_first_leading_zero_ull(unsigned long long value)
280 {
281  return stdc_leading_ones_ull(~value);
282 }
283 
284 static inline unsigned int stdc_first_leading_zero_ul(unsigned long value)
285 {
286  return stdc_leading_ones_ul(~value);
287 }
288 
289 static inline unsigned int stdc_first_leading_zero_ui(unsigned int value)
290 {
291  return stdc_leading_ones_ui(~value);
292 }
293 
294 static inline unsigned int stdc_first_leading_zero_us(unsigned short value)
295 {
296  return stdc_leading_ones_us(~value);
297 }
298 
299 static inline unsigned int stdc_first_leading_zero_uc(unsigned char value)
300 {
301  return stdc_leading_ones_uc(~value);
302 }
303 
304 #define stdc_first_leading_zero(value) \
305  __stdbit_generic_type_func(first_leading_zero, value)
306 
307 #if defined (__GNUC__) || defined (__clang__)
308 static inline unsigned int stdc_first_trailing_one_ull(unsigned long long value)
309 {
310  return __builtin_ffsll(value);
311 }
312 
313 static inline unsigned int stdc_first_trailing_one_ul(unsigned long value)
314 {
315  return __builtin_ffsl(value);
316 }
317 
318 static inline unsigned int stdc_first_trailing_one_ui(unsigned int value)
319 {
320  return __builtin_ffs(value);
321 }
322 
323 static inline unsigned int stdc_first_trailing_one_us(unsigned short value)
324 {
325  return __builtin_ffs(value);
326 }
327 
328 static inline unsigned int stdc_first_trailing_one_uc(unsigned char value)
329 {
330  return __builtin_ffs(value);
331 }
332 #else
333 static inline unsigned int stdc_first_trailing_one_ull(unsigned long long value)
334 {
335  return value ? (1 + stdc_trailing_zeros_ull(value)) : 0;
336 }
337 
338 static inline unsigned int stdc_first_trailing_one_ul(unsigned long value)
339 {
340  return value ? (1 + stdc_trailing_zeros_ul(value)) : 0;
341 }
342 
343 static inline unsigned int stdc_first_trailing_one_ui(unsigned int value)
344 {
345  return value ? (1 + stdc_trailing_zeros_ui(value)) : 0;
346 }
347 
348 static inline unsigned int stdc_first_trailing_one_us(unsigned short value)
349 {
350  return value ? (1 + stdc_trailing_zeros_us(value)) : 0;
351 }
352 
353 static inline unsigned int stdc_first_trailing_one_uc(unsigned char value)
354 {
355  return value ? (1 + stdc_trailing_zeros_uc(value)) : 0;
356 }
357 #endif
358 
359 #define stdc_first_trailing_one(value) \
360  __stdbit_generic_type_func(first_trailing_one, value)
361 
362 static inline unsigned int stdc_first_trailing_zero_ull(unsigned long long value)
363 {
365 }
366 
367 static inline unsigned int stdc_first_trailing_zero_ul(unsigned long value)
368 {
370 }
371 
372 static inline unsigned int stdc_first_trailing_zero_ui(unsigned int value)
373 {
375 }
376 
377 static inline unsigned int stdc_first_trailing_zero_us(unsigned short value)
378 {
380 }
381 
382 static inline unsigned int stdc_first_trailing_zero_uc(unsigned char value)
383 {
385 }
386 
387 #define stdc_first_trailing_zero(value) \
388  __stdbit_generic_type_func(first_trailing_zero, value)
389 
390 #if defined (__GNUC__) || defined (__clang__)
391 static inline unsigned int stdc_count_ones_ull(unsigned long long value)
392 {
393  return __builtin_popcountll(value);
394 }
395 
396 static inline unsigned int stdc_count_ones_ul(unsigned long value)
397 {
398  return __builtin_popcountl(value);
399 }
400 
401 static inline unsigned int stdc_count_ones_ui(unsigned int value)
402 {
403  return __builtin_popcount(value);
404 }
405 
406 static inline unsigned int stdc_count_ones_us(unsigned short value)
407 {
408  return __builtin_popcount(value);
409 }
410 
411 static inline unsigned int stdc_count_ones_uc(unsigned char value)
412 {
413  return __builtin_popcount(value);
414 }
415 #else
416 static inline unsigned int __stdc_count_ones(unsigned long long value,
417  unsigned int size)
418 {
419  unsigned int ones = 0;
420 
421  for (unsigned int c = 0; c < (size * CHAR_BIT); c++) {
422  ones += value & 1;
423  value >>= 1;
424  }
425 
426  return ones;
427 }
428 
429 static inline unsigned int stdc_count_ones_ull(unsigned long long value)
430 {
431  return __stdc_count_ones(value, sizeof (value));
432 }
433 
434 static inline unsigned int stdc_count_ones_ul(unsigned long value)
435 {
436  return __stdc_count_ones(value, sizeof (value));
437 }
438 
439 static inline unsigned int stdc_count_ones_ui(unsigned int value)
440 {
441  return __stdc_count_ones(value, sizeof (value));
442 }
443 
444 static inline unsigned int stdc_count_ones_us(unsigned short value)
445 {
446  return __stdc_count_ones(value, sizeof (value));
447 }
448 
449 static inline unsigned int stdc_count_ones_uc(unsigned char value)
450 {
451  return __stdc_count_ones(value, sizeof (value));
452 }
453 #endif
454 
455 #define stdc_count_ones(value) \
456  __stdbit_generic_type_func(count_ones, value)
457 
458 static inline unsigned int stdc_count_zeros_ull(unsigned long long value)
459 {
460  return stdc_count_ones_ull(~value);
461 }
462 
463 static inline unsigned int stdc_count_zeros_ul(unsigned long value)
464 {
465  return stdc_count_ones_ul(~value);
466 }
467 
468 static inline unsigned int stdc_count_zeros_ui(unsigned int value)
469 {
470  return stdc_count_ones_ui(~value);
471 }
472 
473 static inline unsigned int stdc_count_zeros_us(unsigned short value)
474 {
475  return stdc_count_ones_us(~value);
476 }
477 
478 static inline unsigned int stdc_count_zeros_uc(unsigned char value)
479 {
480  return stdc_count_ones_uc(~value);
481 }
482 
483 #define stdc_count_zeros(value) \
484  __stdbit_generic_type_func(count_zeros, value)
485 
486 static inline bool stdc_has_single_bit_ull(unsigned long long value)
487 {
488  return value && (value & (value - 1)) == 0;
489 }
490 
491 static inline bool stdc_has_single_bit_ul(unsigned long value)
492 {
493  return value && (value & (value - 1)) == 0;
494 }
495 
496 static inline bool stdc_has_single_bit_ui(unsigned int value)
497 {
498  return value && (value & (value - 1)) == 0;
499 }
500 
501 static inline bool stdc_has_single_bit_us(unsigned short value)
502 {
503  return value && (value & (value - 1)) == 0;
504 }
505 
506 static inline bool stdc_has_single_bit_uc(unsigned char value)
507 {
508  return value && (value & (value - 1)) == 0;
509 }
510 
511 #define stdc_has_single_bit(value) \
512  __stdbit_generic_type_func(has_single_bit, value)
513 
514 static inline unsigned int stdc_bit_width_ull(unsigned long long value)
515 {
516  return (CHAR_BIT * sizeof (value)) - stdc_leading_zeros_ull(value);
517 }
518 
519 static inline unsigned int stdc_bit_width_ul(unsigned long value)
520 {
521  return (CHAR_BIT * sizeof (value)) - stdc_leading_zeros_ul(value);
522 }
523 
524 static inline unsigned int stdc_bit_width_ui(unsigned int value)
525 {
526  return (CHAR_BIT * sizeof (value)) - stdc_leading_zeros_ui(value);
527 }
528 
529 static inline unsigned int stdc_bit_width_us(unsigned short value)
530 {
531  return (CHAR_BIT * sizeof (value)) - stdc_leading_zeros_us(value);
532 }
533 
534 static inline unsigned int stdc_bit_width_uc(unsigned char value)
535 {
536  return (CHAR_BIT * sizeof (value)) - stdc_leading_zeros_uc(value);
537 }
538 
539 #define stdc_bit_width(value) \
540  __stdbit_generic_type_func(bit_width, value)
541 
542 static inline unsigned long long stdc_bit_floor_ull(unsigned long long value)
543 {
544  return value ? (1ULL << (stdc_bit_width_ull(value) - 1)) : 0ULL;
545 }
546 
547 static inline unsigned long stdc_bit_floor_ul(unsigned long value)
548 {
549  return value ? (1UL << (stdc_bit_width_ul(value) - 1)) : 0UL;
550 }
551 
552 static inline unsigned int stdc_bit_floor_ui(unsigned int value)
553 {
554  return value ? (1U << (stdc_bit_width_ui(value) - 1)) : 0U;
555 }
556 
557 static inline unsigned short stdc_bit_floor_us(unsigned short value)
558 {
559  return value ? (1U << (stdc_bit_width_us(value) - 1)) : 0U;
560 }
561 
562 static inline unsigned int stdc_bit_floor_uc(unsigned char value)
563 {
564  return value ? (1U << (stdc_bit_width_uc(value) - 1)) : 0U;
565 }
566 
567 #define stdc_bit_floor(value) \
568  __stdbit_generic_type_func(bit_floor, value)
569 
570 /* NOTE: Bit ceiling undefines overflow. */
571 static inline unsigned long long stdc_bit_ceil_ull(unsigned long long value)
572 {
573  return 1ULL << (value ? stdc_bit_width_ull(value - 1) : 0);
574 }
575 
576 static inline unsigned long stdc_bit_ceil_ul(unsigned long value)
577 {
578  return 1UL << (value ? stdc_bit_width_ul(value - 1) : 0);
579 }
580 
581 static inline unsigned int stdc_bit_ceil_ui(unsigned int value)
582 {
583  return 1U << (value ? stdc_bit_width_ui(value - 1) : 0);
584 }
585 
586 static inline unsigned short stdc_bit_ceil_us(unsigned short value)
587 {
588  return 1U << (value ? stdc_bit_width_us(value - 1) : 0);
589 }
590 
591 static inline unsigned int stdc_bit_ceil_uc(unsigned char value)
592 {
593  return 1U << (value ? stdc_bit_width_uc(value - 1) : 0);
594 }
595 
596 #define stdc_bit_ceil(value) \
597  __stdbit_generic_type_func(bit_ceil, value)
598 
599 #endif /* __STDC_VERSION_STDBIT_H__ */
stdc_first_leading_one_us
static unsigned int stdc_first_leading_one_us(unsigned short value)
Definition: stdbit.h:266
stdc_first_trailing_one_ull
static unsigned int stdc_first_trailing_one_ull(unsigned long long value)
Definition: stdbit.h:308
stdc_has_single_bit_us
static bool stdc_has_single_bit_us(unsigned short value)
Definition: stdbit.h:501
stdc_count_zeros_uc
static unsigned int stdc_count_zeros_uc(unsigned char value)
Definition: stdbit.h:478
stdc_bit_width_ul
static unsigned int stdc_bit_width_ul(unsigned long value)
Definition: stdbit.h:519
stdc_bit_floor_uc
static unsigned int stdc_bit_floor_uc(unsigned char value)
Definition: stdbit.h:562
stdc_leading_zeros_ull
static unsigned int stdc_leading_zeros_ull(unsigned long long value)
Definition: stdbit.h:51
stdc_bit_ceil_us
static unsigned short stdc_bit_ceil_us(unsigned short value)
Definition: stdbit.h:586
stdc_leading_ones_us
static unsigned int stdc_leading_ones_us(unsigned short value)
Definition: stdbit.h:134
stdc_count_ones_ul
static unsigned int stdc_count_ones_ul(unsigned long value)
Definition: stdbit.h:396
stdc_first_leading_zero_ui
static unsigned int stdc_first_leading_zero_ui(unsigned int value)
Definition: stdbit.h:289
stdc_count_zeros_ul
static unsigned int stdc_count_zeros_ul(unsigned long value)
Definition: stdbit.h:463
stdc_leading_zeros_ul
static unsigned int stdc_leading_zeros_ul(unsigned long value)
Definition: stdbit.h:56
stdc_trailing_zeros_us
static unsigned int stdc_trailing_zeros_us(unsigned short value)
Definition: stdbit.h:166
stdc_bit_ceil_ull
static unsigned long long stdc_bit_ceil_ull(unsigned long long value)
Definition: stdbit.h:571
stdc_count_ones_us
static unsigned int stdc_count_ones_us(unsigned short value)
Definition: stdbit.h:406
stdc_count_ones_ui
static unsigned int stdc_count_ones_ui(unsigned int value)
Definition: stdbit.h:401
stdc_trailing_zeros_ui
static unsigned int stdc_trailing_zeros_ui(unsigned int value)
Definition: stdbit.h:160
stdc_first_trailing_zero_ul
static unsigned int stdc_first_trailing_zero_ul(unsigned long value)
Definition: stdbit.h:367
stdc_trailing_zeros_ul
static unsigned int stdc_trailing_zeros_ul(unsigned long value)
Definition: stdbit.h:154
stdc_first_trailing_zero_us
static unsigned int stdc_first_trailing_zero_us(unsigned short value)
Definition: stdbit.h:377
stdc_trailing_ones_ui
static unsigned int stdc_trailing_ones_ui(unsigned int value)
Definition: stdbit.h:233
stdc_leading_zeros_us
static unsigned int stdc_leading_zeros_us(unsigned short value)
Definition: stdbit.h:66
stdc_count_ones_uc
static unsigned int stdc_count_ones_uc(unsigned char value)
Definition: stdbit.h:411
stdc_trailing_zeros_ull
static unsigned int stdc_trailing_zeros_ull(unsigned long long value)
Definition: stdbit.h:148
stdc_has_single_bit_uc
static bool stdc_has_single_bit_uc(unsigned char value)
Definition: stdbit.h:506
stdc_has_single_bit_ui
static bool stdc_has_single_bit_ui(unsigned int value)
Definition: stdbit.h:496
stdc_trailing_ones_ul
static unsigned int stdc_trailing_ones_ul(unsigned long value)
Definition: stdbit.h:228
stdc_leading_ones_ull
static unsigned int stdc_leading_ones_ull(unsigned long long value)
Definition: stdbit.h:119
limits.h
stdc_bit_floor_ul
static unsigned long stdc_bit_floor_ul(unsigned long value)
Definition: stdbit.h:547
stdc_bit_ceil_ul
static unsigned long stdc_bit_ceil_ul(unsigned long value)
Definition: stdbit.h:576
stdc_bit_floor_ui
static unsigned int stdc_bit_floor_ui(unsigned int value)
Definition: stdbit.h:552
stdc_first_leading_one_ul
static unsigned int stdc_first_leading_one_ul(unsigned long value)
Definition: stdbit.h:256
stdc_trailing_ones_uc
static unsigned int stdc_trailing_ones_uc(unsigned char value)
Definition: stdbit.h:243
stdc_bit_width_uc
static unsigned int stdc_bit_width_uc(unsigned char value)
Definition: stdbit.h:534
c
Undefined Behavior In the C some operations are like signed integer dereferencing freed accessing outside allocated Undefined Behavior must not occur in a C it is not safe even if the output of undefined operations is unused The unsafety may seem nit picking but Optimizing compilers have in fact optimized code on the assumption that no undefined Behavior occurs Optimizing code based on wrong assumptions can and has in some cases lead to effects beyond the output of computations The signed integer overflow problem in speed critical code Code which is highly optimized and works with signed integers sometimes has the problem that often the output of the computation does not c
Definition: undefined.txt:32
stdc_bit_width_us
static unsigned int stdc_bit_width_us(unsigned short value)
Definition: stdbit.h:529
stdc_has_single_bit_ul
static bool stdc_has_single_bit_ul(unsigned long value)
Definition: stdbit.h:491
stdc_first_trailing_one_us
static unsigned int stdc_first_trailing_one_us(unsigned short value)
Definition: stdbit.h:323
stdc_trailing_zeros_uc
static unsigned int stdc_trailing_zeros_uc(unsigned char value)
Definition: stdbit.h:172
size
int size
Definition: twinvq_data.h:10344
stdc_count_zeros_ui
static unsigned int stdc_count_zeros_ui(unsigned int value)
Definition: stdbit.h:468
stdc_leading_ones_ul
static unsigned int stdc_leading_ones_ul(unsigned long value)
Definition: stdbit.h:124
stdc_first_trailing_zero_ull
static unsigned int stdc_first_trailing_zero_ull(unsigned long long value)
Definition: stdbit.h:362
stdc_first_leading_one_uc
static unsigned int stdc_first_leading_one_uc(unsigned char value)
Definition: stdbit.h:271
stdc_bit_floor_ull
static unsigned long long stdc_bit_floor_ull(unsigned long long value)
Definition: stdbit.h:542
stdc_leading_ones_ui
static unsigned int stdc_leading_ones_ui(unsigned int value)
Definition: stdbit.h:129
stdc_first_leading_one_ui
static unsigned int stdc_first_leading_one_ui(unsigned int value)
Definition: stdbit.h:261
stdc_leading_zeros_ui
static unsigned int stdc_leading_zeros_ui(unsigned int value)
Definition: stdbit.h:61
stdc_first_trailing_one_uc
static unsigned int stdc_first_trailing_one_uc(unsigned char value)
Definition: stdbit.h:328
stdc_first_leading_one_ull
static unsigned int stdc_first_leading_one_ull(unsigned long long value)
Definition: stdbit.h:251
stdc_count_ones_ull
static unsigned int stdc_count_ones_ull(unsigned long long value)
Definition: stdbit.h:391
stdc_first_trailing_zero_ui
static unsigned int stdc_first_trailing_zero_ui(unsigned int value)
Definition: stdbit.h:372
stdc_leading_ones_uc
static unsigned int stdc_leading_ones_uc(unsigned char value)
Definition: stdbit.h:139
value
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf default value
Definition: writing_filters.txt:86
stdc_first_trailing_one_ul
static unsigned int stdc_first_trailing_one_ul(unsigned long value)
Definition: stdbit.h:313
stdc_first_trailing_zero_uc
static unsigned int stdc_first_trailing_zero_uc(unsigned char value)
Definition: stdbit.h:382
stdc_trailing_ones_ull
static unsigned int stdc_trailing_ones_ull(unsigned long long value)
Definition: stdbit.h:223
stdc_bit_width_ull
static unsigned int stdc_bit_width_ull(unsigned long long value)
Definition: stdbit.h:514
U
#define U(x)
Definition: vpx_arith.h:37
stdc_has_single_bit_ull
static bool stdc_has_single_bit_ull(unsigned long long value)
Definition: stdbit.h:486
stdc_leading_zeros_uc
static unsigned int stdc_leading_zeros_uc(unsigned char value)
Definition: stdbit.h:72
stdc_first_leading_zero_ul
static unsigned int stdc_first_leading_zero_ul(unsigned long value)
Definition: stdbit.h:284
stdc_count_zeros_ull
static unsigned int stdc_count_zeros_ull(unsigned long long value)
Definition: stdbit.h:458
stdc_trailing_ones_us
static unsigned int stdc_trailing_ones_us(unsigned short value)
Definition: stdbit.h:238
stdc_bit_ceil_uc
static unsigned int stdc_bit_ceil_uc(unsigned char value)
Definition: stdbit.h:591
stdc_count_zeros_us
static unsigned int stdc_count_zeros_us(unsigned short value)
Definition: stdbit.h:473
stdc_bit_ceil_ui
static unsigned int stdc_bit_ceil_ui(unsigned int value)
Definition: stdbit.h:581
stdc_bit_width_ui
static unsigned int stdc_bit_width_ui(unsigned int value)
Definition: stdbit.h:524
stdc_first_trailing_one_ui
static unsigned int stdc_first_trailing_one_ui(unsigned int value)
Definition: stdbit.h:318
stdc_first_leading_zero_ull
static unsigned int stdc_first_leading_zero_ull(unsigned long long value)
Definition: stdbit.h:279
stdc_first_leading_zero_us
static unsigned int stdc_first_leading_zero_us(unsigned short value)
Definition: stdbit.h:294
stdc_first_leading_zero_uc
static unsigned int stdc_first_leading_zero_uc(unsigned char value)
Definition: stdbit.h:299
stdc_bit_floor_us
static unsigned short stdc_bit_floor_us(unsigned short value)
Definition: stdbit.h:557