Khatoblepas
Still Fresh
I'm trying to code a sprite loader (of my own invention), and I want to store my sprites in 4bit, to conserve space (half as much as 8bit. If I had 10mb of sprites, it would equate to 5mb of 4bit sprites) and stop wastage... but I still have to think about engine efficiency.
Is it practical to split up an 8bit variable into two, effectively having the upper and lower halves in different variables?
And if so, how do you do it? I know you can split up a 16bit variable into an 8bit variable by using inline assembler to move the higher and lower bytes into different places:
But I'm stumped as to how to split it further efficiently.
Any suggestions? o.o
Is it practical to split up an 8bit variable into two, effectively having the upper and lower halves in different variables?
And if so, how do you do it? I know you can split up a 16bit variable into an 8bit variable by using inline assembler to move the higher and lower bytes into different places:
Code:
//This x86 ASM is probably very, very wrong. Gonna have to brush up on my inline ASM!
unsigned short var = 32721;
unsigned char varlower;
unsigned char varupper;
asm {
mov a, var;Move var into register a
mov varupper, ah;Move upper byte into variable
mov varlower, al; Same with the lower byte.
}
But I'm stumped as to how to split it further efficiently.
Any suggestions? o.o