diff options
author | Erik de Castro Lopo <erikd@mega-nerd.com> | 2015-12-25 09:40:59 +1100 |
---|---|---|
committer | Erik de Castro Lopo <erikd@mega-nerd.com> | 2015-12-25 09:41:02 +1100 |
commit | a758365007eae1b2b540554f540df57860da4901 (patch) | |
tree | bd658d99ef1b1b11098ab3c68073d4a34ff985f9 /src/libFLAC/include | |
parent | e4399a02aebc7933d537204c9fbbabb3d96b7cd5 (diff) | |
download | flac-a758365007eae1b2b540554f540df57860da4901.tar.gz |
bitmath.h: Whitespace only
Patch-from: lvqcl <lvqcl.mail@gmail.com>
Diffstat (limited to 'src/libFLAC/include')
-rw-r--r-- | src/libFLAC/include/private/bitmath.h | 134 |
1 files changed, 67 insertions, 67 deletions
diff --git a/src/libFLAC/include/private/bitmath.h b/src/libFLAC/include/private/bitmath.h index 22d894f8..090c6e51 100644 --- a/src/libFLAC/include/private/bitmath.h +++ b/src/libFLAC/include/private/bitmath.h @@ -47,58 +47,58 @@ /* Will never be emitted for MSVC, GCC, Intel compilers */ static inline unsigned int FLAC__clz_soft_uint32(unsigned int word) { - static const unsigned char byte_to_unary_table[] = { - 8, 7, 6, 6, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4, - 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 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 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + }; - return (word) > 0xffffff ? byte_to_unary_table[(word) >> 24] : - (word) > 0xffff ? byte_to_unary_table[(word) >> 16] + 8 : - (word) > 0xff ? byte_to_unary_table[(word) >> 8] + 16 : - byte_to_unary_table[(word)] + 24; + return (word) > 0xffffff ? byte_to_unary_table[(word) >> 24] : + (word) > 0xffff ? byte_to_unary_table[(word) >> 16] + 8 : + (word) > 0xff ? byte_to_unary_table[(word) >> 8] + 16 : + byte_to_unary_table[(word)] + 24; } static inline unsigned int FLAC__clz_uint32(FLAC__uint32 v) { /* Never used with input 0 */ - FLAC__ASSERT(v > 0); + FLAC__ASSERT(v > 0); #if defined(__INTEL_COMPILER) - return _bit_scan_reverse(v) ^ 31U; + return _bit_scan_reverse(v) ^ 31U; #elif defined(__GNUC__) && (__GNUC__ >= 4 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) /* This will translate either to (bsr ^ 31U), clz , ctlz, cntlz, lzcnt depending on * -march= setting or to a software routine in exotic machines. */ - return __builtin_clz(v); + return __builtin_clz(v); #elif defined(_MSC_VER) && (_MSC_VER >= 1400) - { - unsigned long idx; - _BitScanReverse(&idx, v); - return idx ^ 31U; - } + { + unsigned long idx; + _BitScanReverse(&idx, v); + return idx ^ 31U; + } #else - return FLAC__clz_soft_uint32(v); + return FLAC__clz_soft_uint32(v); #endif } /* This one works with input 0 */ static inline unsigned int FLAC__clz2_uint32(FLAC__uint32 v) { - if (!v) - return 32; - return FLAC__clz_uint32(v); + if (!v) + return 32; + return FLAC__clz_uint32(v); } /* An example of what FLAC__bitmath_ilog2() computes: @@ -126,17 +126,17 @@ static inline unsigned int FLAC__clz2_uint32(FLAC__uint32 v) static inline unsigned FLAC__bitmath_ilog2(FLAC__uint32 v) { - FLAC__ASSERT(v > 0); + FLAC__ASSERT(v > 0); #if defined(__INTEL_COMPILER) - return _bit_scan_reverse(v); + return _bit_scan_reverse(v); #elif defined(_MSC_VER) && (_MSC_VER >= 1400) - { - unsigned long idx; - _BitScanReverse(&idx, v); - return idx; - } + { + unsigned long idx; + _BitScanReverse(&idx, v); + return idx; + } #else - return sizeof(FLAC__uint32) * CHAR_BIT - 1 - FLAC__clz_uint32(v); + return sizeof(FLAC__uint32) * CHAR_BIT - 1 - FLAC__clz_uint32(v); #endif } @@ -145,37 +145,37 @@ static inline unsigned FLAC__bitmath_ilog2(FLAC__uint32 v) static inline unsigned FLAC__bitmath_ilog2_wide(FLAC__uint64 v) { - FLAC__ASSERT(v > 0); + FLAC__ASSERT(v > 0); #if defined(__GNUC__) && (__GNUC__ >= 4 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) - return sizeof(FLAC__uint64) * CHAR_BIT - 1 - __builtin_clzll(v); + return sizeof(FLAC__uint64) * CHAR_BIT - 1 - __builtin_clzll(v); /* Sorry, only supported in x64/Itanium.. and both have fast FPU which makes integer-only encoder pointless */ #elif (defined(_MSC_VER) && (_MSC_VER >= 1400)) && (defined(_M_IA64) || defined(_M_X64)) - { - unsigned long idx; - _BitScanReverse64(&idx, v); - return idx; - } + { + unsigned long idx; + _BitScanReverse64(&idx, v); + return idx; + } #else /* Brain-damaged compilers will use the fastest possible way that is, - de Bruijn sequences (http://supertech.csail.mit.edu/papers/debruijn.pdf) - (C) Timothy B. Terriberry (tterribe@xiph.org) 2001-2009 CC0 (Public domain). + de Bruijn sequences (http://supertech.csail.mit.edu/papers/debruijn.pdf) + (C) Timothy B. Terriberry (tterribe@xiph.org) 2001-2009 CC0 (Public domain). */ - { - static const unsigned char DEBRUIJN_IDX64[64]={ - 0, 1, 2, 7, 3,13, 8,19, 4,25,14,28, 9,34,20,40, - 5,17,26,38,15,46,29,48,10,31,35,54,21,50,41,57, - 63, 6,12,18,24,27,33,39,16,37,45,47,30,53,49,56, - 62,11,23,32,36,44,52,55,61,22,43,51,60,42,59,58 - }; - v|= v>>1; - v|= v>>2; - v|= v>>4; - v|= v>>8; - v|= v>>16; - v|= v>>32; - v= (v>>1)+1; - return DEBRUIJN_IDX64[v*0x218A392CD3D5DBF>>58&0x3F]; - } + { + static const unsigned char DEBRUIJN_IDX64[64]={ + 0, 1, 2, 7, 3,13, 8,19, 4,25,14,28, 9,34,20,40, + 5,17,26,38,15,46,29,48,10,31,35,54,21,50,41,57, + 63, 6,12,18,24,27,33,39,16,37,45,47,30,53,49,56, + 62,11,23,32,36,44,52,55,61,22,43,51,60,42,59,58 + }; + v|= v>>1; + v|= v>>2; + v|= v>>4; + v|= v>>8; + v|= v>>16; + v|= v>>32; + v= (v>>1)+1; + return DEBRUIJN_IDX64[v*0x218A392CD3D5DBF>>58&0x3F]; + } #endif } #endif |