.TI F77/BITS "June 15, 1985"
Bit Manipulation: Octal, Hexadecimal and Binary

The built-in bit manipulation functions:

.nf
	and, or, xor, not, rshift, lshift
.fi

are described in "man 3f bit".  That manual section
also illustrates how to use them to set, clear,
and access bits within words.

Bit strings can be used in data statements:

.nf
	integer a(3)
	data a/b'1010', o'12', z'a'/
.fi

These statements initialize the three elements of a() to the
decimal value 10 using
binary, octal and hexadecimal constants.

When using bit strings and bit manipulation, be careful as
VAXs access memory bytes in a different order depending on whether
the operand is a byte, word, long word or character string.

Values can be printed out in octal and hex by using the 'o' and 'z'
format terms.  The program:
.nf

		i = 125
		print 100, i, i, i
	100	format('  decimal:    octal:      hex:'/ i10, o10, z10 )
		end

prints:

	  decimal:    octal:      hex:
	       125       175        7d

.fi
The next sample illustrates how to use the unsigned format specifier, 'su',
to treat the sign as an ordinary bit and how to print leading blanks as zeros:
.nf

		i = -127
		j = 63
		print 100, i, i, j, j
	100	format('hex:   ',su,z8.8/ 'octal: ', o11.11)
		end

prints:

	hex:   ffffff81
	octal: 37777777601
	hex:   0000003f
	octal: 00000000077

.fi
