64 bit Systems

Whether you're a newbie or an experienced programmer, any questions, help, or just talk of any language will be welcomed here.

Moderator: Coders of Rage

Post Reply
User avatar
davidthefat
Chaos Rift Maniac
Chaos Rift Maniac
Posts: 529
Joined: Mon Nov 10, 2008 3:51 pm
Current Project: Fully Autonomous Robot
Favorite Gaming Platforms: PS3
Programming Language of Choice: C++
Location: California
Contact:

64 bit Systems

Post by davidthefat »

Since Windows uses the LLP64 model. Is it okay to just use 64 bit integers instead of 32 bit integers all throughout the program? Is it going to be any slower to use 32 bit integers on a 64 bit system because the system constantly has to put the number in the right part of the register. The downside of using all 64bit integers is the extra space it takes up on memory.
User avatar
Falco Girgis
Elysian Shadows Team
Elysian Shadows Team
Posts: 10294
Joined: Thu May 20, 2004 2:04 pm
Current Project: Elysian Shadows
Favorite Gaming Platforms: Dreamcast, SNES, NES
Programming Language of Choice: C/++
Location: Studio Vorbis, AL
Contact:

Re: 64 bit Systems

Post by Falco Girgis »

davidthefat wrote:Since Windows uses the LLP64 model. Is it okay to just use 64 bit integers instead of 32 bit integers all throughout the program?
Yes.
davidthefat wrote:Is it going to be any slower to use 32 bit integers on a 64 bit system because the system constantly has to put the number in the right part of the register.
No. That's not the way it works. It's loaded directly into the correct half of the register in a single operation as it would be a 32-bit CPU. Otherwise x86 applications would run like shit under x64...
davidthefat wrote:The downside of using all 64bit integers is the extra space it takes up on memory.
Yes, and generally speaking, unless you're doing some low-level things with pointers and memory-mapped IO with devices on a 32-bit address space, that's the only downside.
User avatar
avansc
Respected Programmer
Respected Programmer
Posts: 1708
Joined: Sun Nov 02, 2008 6:29 pm

Re: 64 bit Systems

Post by avansc »

also take note of how you lay out structures, specially if they have pointers in them, you can end up wasting a lot of space. not that it really matters. but if you were curious.
Some person, "I have a black belt in karate"
Dad, "Yea well I have a fan belt in street fighting"
Post Reply