Tuesday, June 9, 2009

Line of code of the day #3

So... remember that little problem i had to 'compact' selected bits? i think i solved it... By using a very special look-up table i manage to do the trick using this 'easy' to read line:
(( f[(m & 0xF0) | (val & 0xF0) >> 4] >> 3) >> (f[(m & 0x0F)<< 4 | (val & 0x0f )] >> 3 ) & 0xF)

Oh, this code is just for 8bits, a simple expansion allows me to use it for 32bits (with look-up table taking up 2Mb)... and no... I won't explain what is in f table has... and yes... I might screw up with the parentesis... I didn't compile that piece of code, but tested it manually instead... it should work... efficiency wise it's better that scan all bits one by one...

You can now commit suicide.

PS: By reading this you agree that i'm not responsible for any harm occoured both physically or mentally when reading the text above... really...

No comments: