13.6.1 Mixed endian and dot notation

Prev Up Next Page 461 of 800 Search internet


Mixed endian hexadecimal 8001 denotes a byte vector of length 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 interpreted as a cardinal, then bit 0 of the byte is the least significant bit of the byte. (2) Whenever a sequence of bytes is interpreted 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 standardization error which will be hard to correct. As a result, Europeans have to left justify text and right justify numbers, leading to complications 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)

80.1 (hexadecimal dot notation)

8001 (hexadecimal mixed endian notation)

Spaces can be added and removed freely.

Leading zeros may be added and suppressed freely in dot notation.

The bitvector B has been chosen to illustrate a confusing feature of mixed endian notation: 8001 has two 1 bits which are next to each other. That may seem unreasonable since the '8' and the '1' in 8001 is far apart. But if you find that confusing, don't blame me, blame my ancestors who didn't get the positional number system right in the first place.

Prev Up Next Page 461 of 800 Search logiweb.eu

Copyright © 2010 Klaus Grue, GRD-2010-01-05