RFC 70 (rfc70) - Page 2 of 9


Note on Padding



Alternative Format: Original Text Document



Network Working Group      A Note on Padding                      RFC 70


            W AND W-1       xx...x00....0
                           \__ __/\__ __/
                              V      V
                            n-k-1    k

thus removing the low-order 1 bit;

also W AND -W =           0....010....0
                         __ __/__ __/
                            V      V
                          n-k-1    k

thus isolating the low-order bit.

Below, we will focus solely on this last result; however, in a
particular application it may be advantageous to use a variation.

Determining the Position of an Isolated Bit

The two obvious techniques for finding the bit position of an isolated
bit are to shift repetitively with tests, as above, and to use floating
normalization hardware.  On the PDP-10, in particular, the JFFO
instruction is made to order*.  On machines with hexadecimal
normalization, e.g. IBM 360's and XDS Sigma 7's, the normalization
hardware may not be very convenient.  A different approach uses
division and table look-up.
                                                              k
A word with a single bit on has an unsigned integer value of 2  for
                                         k
0