If iOS is a 32-bit OS, how can we use uint64_t and int64_t?

It seems to work correctly, but I thought most of which could be stored in memory was a 32 bit integer?

Now I'm confused as to what the difference is.

Thanks!

+4
source share
2 answers

The difference is not that you have 64-bit data types that you can use. The difference is the amount of available memory space and the required size of pointers to memory. On a 32-bit OS, you have 2 ^ 32 bytes of address memory, and you need 32-bit pointers to cover it all. On a 64-bit OS, you have 2 ^ 64 bytes of memory space for an address, so pointers must be 64-bit.

On the hardware level, the built-in 64-bit data types may be more optimal on 64-bit equipment, since there will be 64-bit registers and instructions for processing them. Otherwise, the compiler / runtime library will do more work to support / emulate 64-bit operations on 32-bit hardware.

+5
source

I think the other answers did not quite explain this correctly.

uint64_t and int64_t are C data types, not hardware data types. The compiler does everything possible to make these types work as 64-bit unsigned or signed integers. If the hardware provides 64-bit registers and whole operations, it’s good and good - the compiler will use them directly. If the hardware has only 32-bit registers (either 16-bit or 8-bit), then during the compilation and runtime, software emulation is used to complete the tasks.

+9
source

All Articles