Skip to content

Instantly share code, notes, and snippets.

@Corgan
Created April 7, 2015 21:42
Show Gist options
  • Save Corgan/dad9aa01bae43b448ccd to your computer and use it in GitHub Desktop.
Save Corgan/dad9aa01bae43b448ccd to your computer and use it in GitHub Desktop.
uint value = bb.GetBits(6);
if ((value & 0x30) > 0)
{
uint a = (value >> 0x04) & 0x03;
uint b = (uint)((a == 0x03) ? 0x10 : 0);
value = (bb.GetBits((int)(4 * a + b)) << 4) | (value & 0xF);
}
return (int) (base_index + value + 1);
@spheenik
Copy link

spheenik commented Apr 7, 2015

value == 0x10 -> a = 1, b = 0 -> reads 4
value == 0x20 -> a = 2, b = 0 -> reads 8
value == 0x30 -> a = 3, b = 1 -> reads 28

same as my code :(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment