RFC 70 (rfc70) - Page 1 of 9


Note on Padding



Alternative Format: Original Text Document



Network Working Group                                      S. Crocker
Request for Comments #70                                   UCLA
                                                           15 October 70

                           A Note on Padding

The padding on a message is a string of the form 10*.  For Hosts with
word lengths 16, 32, 48, etc., bits long, this string is necessarily in
the last word received from the Imp.  For Hosts with word lengths which
are not a multiple of 16 (but which are at least 16 bits long), the 1
bit will be in either the last word or the next to last word.  Of
course if the 1 bit is in the next to last word, the last word is all
zero.

An unpleasant coding task is discovering the bit position of the 1 bit
within its word.  One obvious technique is to repeatedly test the
low-order bit, shifting the word right one bit position if the
low-order bit is zero.  The following techniques are more pleasant.

Isolating the Low-Order Bit

Let W be a non-zero word, where the word length is n.  Then W is of the
form

            x....x10....0
            \__ __/\__ __/
               V      V
             n-k-1    k

where 0