richgel999 / lzham_alpha

This is LZHAM Alpha8, now supplanted by LZHAM 1.x here: https://github.com/richgel999/lzham_codec
MIT License
3 stars 2 forks source link

lzham_math/total_bits possible improvement #2

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Not a bug just a possibility of improvement.

Instead of:

while (v > 0U) { v >>= 1; l++; }

you can use one of the algorithms presented here:

http://graphics.stanford.edu/~seander/bithacks.html#IntegerLogObvious

Original issue reported on code.google.com by milosz.k...@gmail.com on 18 Aug 2011 at 9:01

GoogleCodeExporter commented 9 years ago
Thanks Milo - I'll look into this when I release the first "official" non-alpha 
version. I hope to do this within the next month or so, but I'm stretched 
pretty thin right now.

Original comment by richge...@gmail.com on 20 May 2012 at 2:38