Thread: Dword

  1. #1
    Bioport Productions
    Join Date
    Oct 2005
    Posts
    215

    Dword

    how many bytes is a DWORD? can't find any references.
    -"What we wish, we readily believe, and what we ourselves think, we imagine others think also."
    PHP Code:
    sadf 

  2. #2
    Supermassive black hole cboard_member's Avatar
    Join Date
    Jul 2005
    Posts
    1,709
    8 bits = 1 byte
    16 bits = 1 word (2 bytes)
    so (assuming I'm right so far ) a dword is 4 bytes.
    Good class architecture is not like a Swiss Army Knife; it should be more like a well balanced throwing knife.

    - Mike McShaffry

  3. #3
    Bioport Productions
    Join Date
    Oct 2005
    Posts
    215
    that's right. that's what I thought, I'll use short from now on, which is 2 bytes thanks.
    -"What we wish, we readily believe, and what we ourselves think, we imagine others think also."
    PHP Code:
    sadf 

  4. #4
    Registered User VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,607
    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.

  5. #5
    Bioport Productions
    Join Date
    Oct 2005
    Posts
    215
    Quote Originally Posted by Bubba
    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
    -"What we wish, we readily believe, and what we ourselves think, we imagine others think also."
    PHP Code:
    sadf 

  6. #6
    Registered User VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,607
    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.

  7. #7
    Bioport Productions
    Join Date
    Oct 2005
    Posts
    215
    Wow, that's awesome. I'll definitely google that later. Thanks man
    -"What we wish, we readily believe, and what we ourselves think, we imagine others think also."
    PHP Code:
    sadf 

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Help calling function is asm
    By brietje698 in forum C++ Programming
    Replies: 24
    Last Post: 12-06-2007, 04:48 PM
  2. Inline asm
    By brietje698 in forum C++ Programming
    Replies: 5
    Last Post: 11-11-2007, 02:54 PM
  3. Getting position from game..
    By brietje698 in forum C++ Programming
    Replies: 1
    Last Post: 10-26-2007, 12:15 PM
  4. brace-enclosed error
    By jdc18 in forum C++ Programming
    Replies: 53
    Last Post: 05-03-2007, 05:49 PM
  5. storage size of regs is unkown
    By Vertex34 in forum C Programming
    Replies: 5
    Last Post: 11-04-2003, 10:17 AM