Public Group

#### Archived

This topic is now archived and is closed to further replies.

# DWORD?

This topic is 5897 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Could someone please explain to me what a DWORD is and how you could find an average of a number of them? I can add, subtract, multiply and divide, cast them as other types, but I can''t seem to add two DWORDs and divide the total in half - everything I''ve tried results in 0 or an error. Visual Studio.NET''s help files don''t seem to have any definition (they list int, float, etc., but not DWORD).

##### Share on other sites
DWORD is the same as an unsigned 32 bit int.

DWORD is a non-standard type.

##### Share on other sites
a DWORD is an unsigned long.

##### Share on other sites
DWORD is typically Windows-specific. Its something Microsoft defines in their headers. As other have mentioned, its just an unsigned int (or unsigned long, which are the same thing under Win32, both 32 bits).

There is no problem with adding two together and dividing the total in half. However, it may be that you want to do a float divide and stick the answer in a float.

float answer = dwordTotal / 2.0f;

DWORD answer = dwordTotal / 2;

Otherwise you might wind up casting a fractional value to an integer (implicitly) and you''ll lose information, maybe even resulting in 0 when the answer should have been 0.5, for example.

##### Share on other sites
DWORD is a double WORD

a WORD is 16 bits of memory
DWORD is 32 bits.

it is guaranteed to be 32bits no matter what processor you use. In future this will make a difference when the standard int changes size.

Thanks guys!

1. 1
Rutin
37
2. 2
3. 3
4. 4
5. 5

• 11
• 10
• 13
• 103
• 11
• ### Forum Statistics

• Total Topics
632976
• Total Posts
3009672
• ### Who's Online (See full list)

There are no registered users currently online

×

## Important Information

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!