How to increase the 32 bit range ?

Started by
1 comment, last by GameDev.net 18 years, 10 months ago
Hi I have a 32 bit fixed point datatype. I was thinking if I want to create a huge world using fixed point 32 bit variables, I would soon run out of range. I thought of a possibility to make the 32 bit datatype to act as a 64 bit datatype and write a routine to emulate it. As I'm using only fixed point I do not have the luxury to use the infinite floating range. My minimal value is 1. Can I get suggessions on how to tacke this issue ? Has someone faced such a problem?
Advertisement

Most C++ compilers, including Visual Studio, support 64bit integers, even if you compile for 32bit processors.

if you want to use 64 bit integers, define them as __int64

char x;
long z;
__int64 w;

if the processor does not support 64 bit registers natively, the compiler will generate the code to emulate it, beware that this is much slower, as every operation with 64 bit variables will require several CPU cycles.
actually you can use the more standard
LONGLONG and must compiler will converted to the apropriated 64 bit type either nativally or by emulation.

This topic is closed to new replies.

Advertisement