Nadodiyin Pulambal

A Wanderer Gripes

Archive for October, 2009

Partial fields of words in MIX

Posted by kovaiputhalvan on October 11, 2009

Section 1.3.1, pp 126 – 127, TAOCP vol 1, 3rd Ed.

… Each field specification (L:R) is actually represented inside the machine by the single number 8L + R; notice that the number fits easily in one byte.

What’s with the 8L + R? Most people would’ve figured this out in about 3 seconds, but not me :)

Each byte in MIX is 6 bits long. Each word is 5 bytes long, and has a sign bit. MIX lets you work on part of each word – hence the (L:R) notation to specify which part of the word you want to work with. (0:5) refers to the entire word, (0:0) the sign bit, (1:5) the “unsigned” part of the word, (5:5) the LSB, and so on.

Which gives us 0 \le L \le 5, 0 \le R \le 5. Each of L and R then require 3 bits to represent – and can fit nicely side by side in a 6-bit MIX byte. The 8L + R packs L and R into a MIX byte – shift L by 3 bits, and slap on R into the remaining 3 bits. Unpacking them is just as easy.

That’s that with the 8L + R.

Posted in TAOCP | Tagged: | Leave a Comment »