which is faster:
BOOL num;
if(num==1)....
or
BYTE num;
if(num & 0x80).....
which is faster:
BOOL num;
if(num==1)....
or
BYTE num;
if(num & 0x80).....
i would guess byte would be faster, although you're talking about a miniscule difference. if you're concerned over speed try using ints.
Just looked them up. BYTE is defined as an unsigned char, BOOL is defined as an int (strangely enough) so I would guess that BYTE is faster to mess with.
oh. in that case, i side with BOOL. integers are manipulated faster than other smaller data pieces.
I wouldnt assume that using a BYTE would automatically help the processor....A BOOL is a typedef for a DWORD which is a typedef for a 32bit value.......as most processors used on PCs use 32Bit registers, using memory less than 32bit might even create more work....I'm not totally sure on this, but from reading I've noticed that lots of coders stick to 32Bit when optimising code...
Anyway.....Is this part of the code so critical that losing 1 or 2 clock cycles would have a noticable effect?