We are writing a program that allocates and frees memory automatically, a garbage collector in other words. It should work in a 64-bit machine and 32-bit machine without having to go in and change the code. This means that our bitwise functions cannot have a, for example, x << 63
, since this would crash in a 32 bit machine.
So what we need is a constant that is set when the program is compiled and it should be either the length of pointer or an uintptr_t
that will be either 4 bytes or 8 bytes long depending on the platform and use these as a starting point.
I hope my question was clear, it wasn't easy to formulate it.