Mixed endian and dot notation

### Summary

Mixed endian hexadecimal 8001 denotes a byte vector of lenght 16 bits (2 bytes) for which bit 7 and 8 are 1 and all other bits are 0. Hence, 8001 has two 1 bits which are next to each other.

### Bit vectors

A bit vector is a tuple of bits where a bit (BInary Term) may be 0 or 1. As an example, < 0 , 0 , 1 , 1 , 0 > is a bit vector of length 5 for which bit zero, one, and four are 0 and bit two and three are 1.

### Byte vectors

A byte vector is a bit vector whose length is a multiple of eight. As an example,

B = < 0,0,0,0, 0,0,0,1, 1,0,0,0, 0,0,0,0 >

is a byte vector of length 16 bits (2 bytes). Bit seven and eight of B are 1 and all other bits are 0.

For 0 ≤ j ≤ 7 and cardinals i we shall refer to bit 8i+j as 'bit j of byte i. Hence, bit 7 of byte 0 and bit 0 of byte 1 of B are 1.

### Logiweb is little endian

Logiweb is consistently 'little endian': (1) Whenever a byte is interpretted as a cardinal, then bit 0 of the byte is the least significant bit of the byte. (2) Whenever a sequence of bytes is interpretted as a cardinal, then byte 0 is the least significant byte.

### The European problem

I have been told the following story which I hope someone can verify: When the Europeans took over the decimal number system from the Arabs, the Arabs wrote numbers the natural way: with the least significant digit first. However, the Europeans forgot to mirror the numbers to reflect that the European writing direction is opposite to the Arabic one. This seems to be a major standardisation error which will be hard to correct. As a result, Europeans have to left justify text and right justify numbers, leading to complication in layout of text. More relevant to Logiweb, it is confusing that bit vectors have their least significant bit left-most.

### Mixed endian and dot notation

To compensate for the 'European problem' above, we use a 'mixed endian' or 'dot' notation for byte vectors in which each byte is written with the most significant bit first but bytes are still written with byte 0 first. As an example, in mixed endian and dot notation, bitvector B above reads:

1000 0000.1 (binary dot notation)

1000 0000 0000 0001 (binary mixed endian notation)

127.1 (decimal dot notation)

127001 (decimal mixed endian notation)