Save a couple of extra bytes

This commit is contained in:
Lorenzo Carletti 2022-12-29 03:37:57 +01:00
parent 229c35f67a
commit 566a1b18a0
7 changed files with 10 additions and 3 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -8,13 +8,20 @@ u8* get_table_pointer(u8* table, u16 entry){
u8 offset_table_pos = 2;
u8 size_initial_offset = ((table[0] >> 0)&1)+1;
u8 size_offsets = ((table[0] >> 1)&1)+1;
u8 offset_shifter = table[0] >> 2;
u8 offset_shifter = (table[0] >> 2) & 7;
u8 offset_shifter_initial_offset = (table[0] >> 5);
if(size_initial_offset == 1)
initial_offset = table[1];
initial_offset = table[1]<<offset_shifter_initial_offset;
else {
initial_offset = table_16[1];
initial_offset = table_16[1]<<offset_shifter_initial_offset;
offset_table_pos = 4;
}
u16 entries = initial_offset-offset_table_pos;
if(size_offsets == 2)
entries >>= 1;
// Sanity check
if(entry >= entries)
entry = 0;
if(size_offsets == 1)
offset = (table[(offset_table_pos)+entry]) << offset_shifter;
else