From Wikipedia:

the term endian or endianness refers to the ordering of individually addressable sub-components within a longer data item as stored in external memory (or, sometimes, as sent on a serial connection). These sub-components are typically 16- or 32-bit words, 8-bit bytes, or even bits.

I was wondering what "addressable" means?

For example, in C, the smallest addressable is a byte/char. How can a bit be addressable?

Thanks and regards!

  • I suggest this two-part test: (1) what is the minimum amount of data (N bits) that can be moved from memory to register using only one machine instruction? (2) When this machine instruction is used, what is the smallest address increment that lets you read the next N bits? (not overlapping with the first read) – rwong Jul 9 '11 at 19:10
  • @rwong: Thanks! Nice questions. I have been thinking them for a while, and expanded it into another post stackoverflow.com/questions/6810819/…. Really appreciate if you could have a look. – Tim Jul 25 '11 at 14:00

How can a bit be addressable?

The 8051/8052 family and some other microcontroller architectures (low and mid-range PIC, Infineon C16x/STM ST10) support bit-addressable addressing. In the 8051, the RAM bytes from 0x20 to 0x2f are bit addressable (128 bits in total). Also, many of the special function registers (SFR's) are bit addressable as well (in particular, those with byte addresses ending in 0 or 8 for the 8051 architecture).

8051 bit addressable memory

To support this, the 8051 has a number of instructions that operate directly on bits, such as set/clear/complement bit, jump if bit is set/not set, etc. These are much more efficient that loading up a general-purpose register and using AND or OR instructions.

For example, the instruction to set bit 3 of byte address 0x2A would be (the value 53h is found in the above table):

SETB 53h

which is a 2-byte, 1 cycle instruction.

Likewise, most C compilers for the 8051 (for example Keil C51) support a "bit" type in addition to standard C types like char, short, int etc. C statements referencing bit variables are compiled into code using the bit-manipulation assembly instructions.

So the code:

bit flag;
flag = 1;

would compile into a single SETB instruction like the example above.


Regarding endianness on bit addressable machines, in general bits in a byte are labelled 7 to 0 (MSB to LSB), as in the diagram above. This is true whether the byte endianness is big endian like Motorola 6800, 68000 and PowerPC, or little endian like the 6502 family, Intel x86, and Amtel AVR.

Oddly, DEC minicomputers 50 years ago used the reverse notation: the PDP-8 numbered bits 0 to 11 (MSB to LSB). These machines were not bit-addressable however. DEC changed to the more common form used today when they came out with the PDP-11.

PDP-8 instruction format

  • 1
    "Most C compilers"? Does that reflect popularity (biassed heavily towards desktop platforms, because there's only a few popular desktop platforms), or is it by-number-of-compilers with relatively niche compiler for embedded platforms? – Steve314 Jul 9 '11 at 21:25
  • And to answer the original question about "endianness" on bit-addressable machines, the question can be rephrased as: if I set a bit using SETB and then read the whole byte, how is the byte value related to the bit address? (It is pretty obvious from the diagram.) – rwong Jul 9 '11 at 22:51
  • @Steve314, I should have written "most C compilers for the 8051 (for example Keil C51)" instead of "most C compilers (for example Keil C51) for the 8051" -- I didn't mean to imply most C compilers support bit types. I'll edit most my post. – tcrosley Jul 10 '11 at 4:08

The misunderstanding here is what the CPU supports in machine instructions, and what a programming language supports (but may have to do in a cumbersome way with machine instructions).

The x86 platform supports loading individual bytes by address, but e.g. the Sparc platform (used by Sun) only supports loading whole words of 4 or 8 bytes which must be aligned at a word boundary. I do not immediately know a platform which can manipulate individual bits in memory without first getting the whole byte, manipulate it and store the byte back.

big-endian, little-endian refers to the order that the individual bytes are placed in the word. x86 is little endian, so for "1234" the lowest address gets the "4", and the highest the "1". Sparc is the other way around. MIPS can be either, and is set at startup time.

So, the answer is: Addressable means that there is a CPU instruction doing what you want. Higher languages can emulate more, but this rarely maps to simple CPU instructions.


If the system assumes that the address X points to the X-th bit of the memory, and that X+1 point to the following bit.

  • How does "the system assume that the address X points to the X-th bit of the memory", not the first bit of some bigger unit such as a byte? – Tim Jul 9 '11 at 15:06
  • If the designer of the system decide to... – BenjaminB Jul 9 '11 at 15:09
  • By system, do you mean CPU or OS? – Tim Jul 9 '11 at 15:10
  • How can one do that in C? – Tim Jul 9 '11 at 15:17
  • You can not do that in C. By system I means everything from CPU to the compiler. You could write a compiler for a language which use bits as addressable units. – BenjaminB Jul 9 '11 at 15:31

The addressable part is referring to sections of memory. For instance I sometimes work on an 8 bit system. Addressing is 16 bits. So the memory could be something like this:

0x00 - Address 1
0x05 - Address 2
0xFF - Address 3

You can only address 8 bits at a time so I could only write to one of the three addresses. The max I can write is 255 (0xFF) and the minimum is 0. If it were a 16 bit system I could write 256 (0x100) to the second address and it would do something like this to the memory:

0x00 - Address 1
0x01 - Address 2
0x00 - Address 3

The layout would differ depending whether the system is little or big endian.

Addressable refers to the size of memory you can write to at one point in time.

If something is 8 bit and you would only want to address the 1st (or 2nd or nth bit or whatever) you would have to write to the memory address that contains the bit you are looking for and write the value you want but only altering the specific bit.

For instance:

0x00 - Address 1 - (0000 0000)

If you wish to alter the second bit, you would have to read the value at this address and flip the bit and then write the new number back to the address. I'm not exactly a pro at C but something like:

int i = *address_1;
i = i | 0x02;
*address_1 = i;

That would read the value at Address 1 (assuming address_1 is a pointer to it), flip the second bit, and then store the new value back in the memory address from which it came.


"addressable" is used because data is stored in memory and depending on the computer architecture memory can be word addressable or byte addressable etc. (describing how data in memory is accessed).

For instance, byte addressable memory, as in the case of the 68K architecture, has memory addresses that correspond to a certain byte in memory.


Furthermore, a word is made up of a certain amount of bytes. Big endian/Little endian notation simply refers to the arrangement of bytes within a word.

For instance, Big endian notation has the most significant bytes addressed by the lower memory address:


lets say we want to store B2F6 in memory and our memory is byte addressable with 2 bytes in one word, then:

Word 0

        |  B2    |  F6     |     BIG ENDIAN NOTATION
       address 0    address 1

'Addressable' means a size of memory that can be addressed individually. This is typically a byte, which is 8 bits. Individual bits within a byte are not addressable. To access individual bits, bit-masking or bit-shifting can be used to remove all but the required bit within the overall byte. Endianness affects the order of storage of individually-addressable bytes within a larger memory block, which is typically 32 bits or 4 bytes (a word).

The larger memory block starts to matter only when dealing with stack frames, as a stack frame has to consume the whole 4-byte memory block. In other words, memory is commonly composed of ordered 4-byte memory blocks, and machine stack instructions can push or pop only 4-byte memory blocks (stack frames). However, machine instructions can still access every byte within a 4-byte memory block.

protected by gnat May 21 '18 at 11:38

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.