I want to write code that compiles easily for either 32 or 64 bit linux under gcc. I guess I'm looking for something like
#ifdef IA32
subl $0x4, %esp
#endif
#ifdef X86_64
subl $0x4, %rsp
#endif
I want to write code that compiles easily for either 32 or 64 bit linux under gcc. I guess I'm looking for something like
#ifdef IA32
subl $0x4, %esp
#endif
#ifdef X86_64
subl $0x4, %rsp
#endif
I believe the following should work:
#if defined __i386__
subl $0x4, %esp
#elif defined __x86_64__
subq $0x4, %rsp
#else
#error Unknown architecture!
#endif
Fixed the suffix on sub
in the 64-bit code for you, too =)