Reputation: 4109
In a 32 bit machine, if you copied an int p, it would copy 4 bytes of information, which would be addressed at 0xbeefbeef, 0xbeefbef0, 0xbeefbef1, 0xbeefbef2 respectively.
Is this the same with 64 bit? Or does it store 2 bytes at a single address?
Upvotes: 4
Views: 2792
Reputation: 380
On a amd64 architecture (also called x86_64 and x64, which is the most common 64-bit architecture), each addressable unit still refers to one byte of memory (8-bits).
Additionally, an int
still usually contains 4 bytes of memory (32-bits), though this can vary from compiler to compiler (as it also does on 32-bit systems).
What will be different is the size of a pointer. On a 32-bit system, pointers are normally 32-bits, but are 64-bits on a 64-bit system (8 bytes). This will allow the computer to access more bytes of memory, but each byte is still 8-bits long.
Upvotes: 4
Reputation: 38218
It depends on the architecture. On most "normal" 64-bit systems (e.g. arm64, x86_64, etc.) memory is "byte addressed," so each memory address refers to one byte (so it's the same as your 32-bit example).
There are systems out there which are not byte addressed, and this can included 64-bit architectures. For example, DSPs are a classic example of systems where char
can be 32-bits (or more) and an individual byte (or rather, octet) is not addressable.
Upvotes: 6