how many bytes is a DWORD? can't find any references.
Printable View
how many bytes is a DWORD? can't find any references.
8 bits = 1 byte
16 bits = 1 word (2 bytes)
so (assuming I'm right so far :)) a dword is 4 bytes.
that's right. that's what I thought, I'll use short from now on, which is 2 bytes :) thanks.
DWORD lines up with the architecture of your CPU better. Each fetch in the computer (assuming a 32-bit CPU running in protected mode) is 32-bits so a WORD wastes 16 bits on every fetch. Check your compiler documentation and options to both understand and change the alignment.
Ohhh, I believe I understand from your post. Thanks Bubba, no more shorts :)Quote:
Originally Posted by Bubba
Nah I'm not saying never use smaller data types. Use what works - or more appropriately what data type fits the task at hand.
But your compiler has an alignment option which allows you to set the data alignment of your code, stack, and data. This means that if you set the alignment to line up better with the memory fetches then your code will be somewhat faster. Not a complete guarantee but most of the time this holds true.
Wow, that's awesome. I'll definitely google that later. Thanks man