Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use 32-bit pointers in 64-bit application?

Our school's project only allows us to compile the c program into 64-bit application and they test our program for speed and memory usage. However, if I am able to use 32-bit pointers, then my program will consume much less memory than in 64-bit, also maybe it runs faster (faster to malloc?)

I am wondering if I can use 32-bit pointers in 64-bit applications?

Thanks for the help

like image 406
kevin Avatar asked Apr 10 '12 05:04

kevin


1 Answers

Using GCC?

The -mx32 option sets int, long, and pointer types to 32 bits, and generates code for the x86-64 architecture. (Intel 386 and AMD x86-64 Options):

  • i386-and-x86_64-Options

  • Other targets, GCC

Then benchmark :)

like image 105
Morpfh Avatar answered Oct 27 '22 01:10

Morpfh