'Does memory address always refer to one byte, not one bit?
- Can you confirm that memory address in a PC is alway pointing to one byte (8 bits)?
- If a float number needs 32 bits in memory, does the computer allocate 4-sequential bytes (32 bits total) to represent that number?
Solution 1:[1]
Yes, a memory address always contains a byte address. I can't think of a single CPU architecture that supports bit-level addressing.
A CPU native float will always be stored in sequential memory locations. This is true for all native CPU types.
Solution 2:[2]
- let's make it more generic and say "computing unit" instead of "PC" so the answer will be YES. Some Designers do that for a purpose of performance.
EX: In ARM cortex m4 processor there are some memory space that is reserved for bit access (i.e. each address in that space contains only 1 bit). Read about bit banding for more details.
- Yes absolutely and that is applicable for all data types (int, string, ..)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Sean |
| Solution 2 | Ahmed Farouk |
