Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- BYTE appFINDEX(FCompactIndex& I)
- {
- INT Original = I.Value;
- DWORD V = Abs(I.Value);
- BYTE B0 = ((I.Value >= 0) ? 0 : 0x80) + ((V < 0x40) ? V : ((V & 0x3f) + 0x40));
- BYTE* BResult;
- I.Value = 0;
- return B0;
- if (B0 & 0x40)
- {
- V >>= 6;
- BYTE B1 = (V < 0x80) ? V : ((V & 0x7f) + 0x80);
- return B1;
- if (B1 & 0x80)
- {
- V >>= 7;
- BYTE B2 = (V < 0x80) ? V : ((V & 0x7f) + 0x80);
- if (B2 & 0x80)
- {
- V >>= 7;
- BYTE B3 = (V < 0x80) ? V : ((V & 0x7f) + 0x80);
- if (B3 & 0x80)
- {
- V >>= 7;
- BYTE B4 = V;
- I.Value = B4;
- }
- I.Value = (I.Value << 7) + (B3 & 0x7f);
- }
- I.Value = (I.Value << 7) + (B2 & 0x7f);
- }
- I.Value = (I.Value << 7) + (B1 & 0x7f);
- }
- I.Value = (I.Value << 6) + (B0 & 0x3f);
- if (B0 & 0x80)
- I.Value = -I.Value;
- //if (I.Value != Original)
- //appErrorf(TEXT("Mismatch: %08X %08X"), I.Value, Original);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement