Reorder the conditions according to the expected distribution of input
signal. This seems to make it almost as fast as the clz builtin using
the bsr instruction.
---
src/libFLAC/bitreader.c |8 +---
1 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/src/libFLAC/bitreader.c b/src/libFLAC/bitreader.c
index 7ae086d..3d947af 100644
--- a/src/libFLAC/bitreader.c
+++ b/src/libFLAC/bitreader.c
@@ -68,9 +68,11 @@ COUNT_ZERO_MSBS (uint32_t word)
#else
/* counts the # of zero MSBs in a word */
#define COUNT_ZERO_MSBS(word) ( \
- (word) = 0x ? \
- ( (word) = 0xff? byte_to_unary_table[word] + 24 :
byte_to_unary_table[(word) 8] + 16 ) : \
- ( (word) = 0xff? byte_to_unary_table[word 16] + 8 :
byte_to_unary_table[(word) 24] ) \
+ (word) 0xff ? byte_to_unary_table[(word) 24] : \
+ !(word) ? 32 : \
+ (word) 0x ? byte_to_unary_table[(word) 16] + 8 : \
+ (word) 0xff ? byte_to_unary_table[(word) 8] + 16 : \
+ byte_to_unary_table[(word)] + 24 \
)
#endif
--
1.7.7.6
___
flac-dev mailing list
flac-dev@xiph.org
http://lists.xiph.org/mailman/listinfo/flac-dev