This code is C++. I can't convert it to C#.
The main problem is !(value & 0xf)
. I don't know what it does!!
I don't know what operator !(int)
does in C++
int GetBitPosition(uint8_t value)
{
const int i4 = !(value & 0xf) << 2;
value >>= i4;
const int i2 = !(value & 0x3) << 1;
value >>= i2;
const int i1 = !(value & 0x1);
const int i0 = (value >> i1) & 1 ? 0 : -8;
return i4 + i2 + i1 + i0;
}