33 #ifndef FLAC__PRIVATE__BITMATH_H 34 #define FLAC__PRIVATE__BITMATH_H 38 #include "../FLAC/ordinals.h" 39 #include "../FLAC/assert.h" 41 #include "../share/compat.h" 50 static const unsigned char byte_to_unary_table[] = {
51 8, 7, 6, 6, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4,
52 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
53 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
54 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
55 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
56 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
57 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
58 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
59 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
60 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
61 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
62 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
63 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
64 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
65 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
66 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
69 return word > 0xffffff ? byte_to_unary_table[word >> 24] :
70 word > 0xffff ? byte_to_unary_table[word >> 16] + 8 :
71 word > 0xff ? byte_to_unary_table[word >> 8] + 16 :
72 byte_to_unary_table[word] + 24;
79 #if defined(__INTEL_COMPILER) 80 return _bit_scan_reverse(
v) ^ 31U;
81 #elif defined(__GNUC__) && (__GNUC__ >= 4 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) 84 return __builtin_clz(
v);
85 #elif defined(_MSC_VER) 88 _BitScanReverse(&
idx,
v);
107 #if defined(__GNUC__) && (__GNUC__ >= 4 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) 108 return __builtin_clzll(
v);
109 #elif (defined(__INTEL_COMPILER) || defined(_MSC_VER)) && (defined(_M_IA64) || defined(_M_X64)) 112 _BitScanReverse64(&
idx,
v);
161 #if defined(__INTEL_COMPILER) 162 return _bit_scan_reverse(
v);
163 #elif defined(_MSC_VER) 166 _BitScanReverse(&
idx,
v);
177 #if defined(__GNUC__) && (__GNUC__ >= 4 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) 178 return __builtin_clzll(
v) ^ 63U;
180 #elif (defined(__INTEL_COMPILER) || defined(_MSC_VER)) && (defined(_M_IA64) || defined(_M_X64)) 183 _BitScanReverse64(&
idx,
v);
192 static const unsigned char DEBRUIJN_IDX64[64]={
193 0, 1, 2, 7, 3,13, 8,19, 4,25,14,28, 9,34,20,40,
194 5,17,26,38,15,46,29,48,10,31,35,54,21,50,41,57,
195 63, 6,12,18,24,27,33,39,16,37,45,47,30,53,49,56,
196 62,11,23,32,36,44,52,55,61,22,43,51,60,42,59,58
205 return DEBRUIJN_IDX64[
v*
FLAC__U64L(0x218A392CD3D5DBF)>>58&0x3F];
static INLINE unsigned int FLAC__clz_soft_uint64(FLAC__uint64 word)
Definition: bitmath.h:97
#define INLINE
Definition: retro_inline.h:35
uint32_t FLAC__uint32
Definition: ordinals.h:65
static INLINE unsigned FLAC__bitmath_ilog2_wide(FLAC__uint64 v)
Definition: bitmath.h:174
unsigned FLAC__bitmath_silog2(FLAC__int64 v)
Definition: bitmath.c:63
int64_t FLAC__int64
Definition: ordinals.h:63
#define FLAC__ASSERT(x)
Definition: assert.h:42
static INLINE unsigned int FLAC__clz_uint64(FLAC__uint64 v)
Definition: bitmath.h:103
#define FLAC__U64L(x)
Definition: compat.h:88
set set set set set set set macro pixldst1 abits if abits op else op endif endm macro pixldst2 abits if abits op else op endif endm macro pixldst4 abits if abits op else op endif endm macro pixldst0 idx
Definition: pixman-arm-neon-asm.h:96
uint64_t FLAC__uint64
Definition: ordinals.h:66
const GLdouble * v
Definition: glext.h:6391
static INLINE unsigned FLAC__bitmath_ilog2(FLAC__uint32 v)
Definition: bitmath.h:158
static INLINE unsigned int FLAC__clz2_uint32(FLAC__uint32 v)
Definition: bitmath.h:121
static INLINE unsigned int FLAC__clz2_uint64(FLAC__uint64 v)
Definition: bitmath.h:128
static INLINE unsigned int FLAC__clz_uint32(FLAC__uint32 v)
Definition: bitmath.h:75
static INLINE unsigned int FLAC__clz_soft_uint32(FLAC__uint32 word)
Definition: bitmath.h:48