Is it easy/possible to run code with 32 bit pointers on a modern 64 bit OS?

Hal Murray hmurray at megapathdsl.net
Mon Mar 27 03:28:52 UTC 2017


fw at fwright.net said:
> The 32-bit x86 architecture is so register-crippled that C code typically
> runs about 15% faster when compiled for X86_64 than when compiled for i386,
> in spite of the poorer cache locality caused by the larger pointers. 

I don't want the code to run in 32 bit mode.

I just want to constrain pointers to have 0s in the top 32 bits so they can 
be stored in 32 bits of memory.  I think that works if loads/stores treat 
them as unsigned.

I don't think there is anything fundamental that constrains pointers to be 
the same size as longs.  I'm not a language wizard.  Some software rule may 
require it, but the hardware doesn't.


fw at fwright.net said:
> It is, however, useful to make 32-on-64-bit builds work for testing 32-bit
> issues.  This is often more complicated than just adding "-m32" to the
> flags. 

I can do that on ARM or an Intel system build for i386.

-- 
These are my opinions.  I hate spam.





More information about the devel mailing list