Routine ID: M421 | |
---|---|
Author(s): C. Letertre, J. Zoll | Library: KERNLIB |
Submitter: | Submitted: 28.01.1971 |
Language: Fortran or Assembler | Revised: 12.06.1987 |
This package manipulates individual bits and bytes in a word.
A bit in a word is specified by giving its position J in the word, bit 1 being the least significant bit.
A byte in a word is a group of NBITS consecutive bits. The byte is specified by giving NBITS and the bit position J of the least significant bit of the byte.
Structure:
SUBROUTINE and FUNCTION subprograms
User Entry Names:
JBIT, | SBIT0, | SBIT1, | SBIT, | MSBIT0, | MSBIT1, | MSBIT, |
JBYT, | SBYT, | MSBYT, | CBYT, | MCBYT, | JBYTET, | JBYTOR, |
SBYTOR, | MBYTOR, | MBYTET, | JRSBYT |
Usage:
IX = JBIT(IW,J) | returns or 1, the value of bit JinIW. |
CALL SBIT0(IX,J) | sets 0into bit Jof IX. |
CALL SBIT1(IX,J) | sets 1into bit Jof IX. |
CALL SBIT(IA,IX,J) | copies bit 1of IAinto bit Jof IX. |
IX = MSBIT0(IW,J) | returns IWin IXwith bit Jset to 0. |
IX = MSBIT1(IW,J) | returns IWin IXwith bit Jset to 1. |
IX = MSBIT(IA,IW,J) | returns IWin IXwith bit Jset to the value of bit1in IA. |
IX = JBYT(IW,J,NBITS) | returns in IXright-justified the byte at Jin IW. |
CALL SBYT(IA,IX,J,NBITS) | copies the byte at 1of IAinto the byte at JofIX. |
IX = MSBYT(IA,IW,J,NBITS) | returns IWin IXwith the byte at Jreplaced by thebyte at |
1of IA. | |
CALL CBYT(IA,JA,IX,J,NBITS) | copies the byte at JAof IAinto the byte at JofIX. |
IX = MCBYT(IA,JA,IW,J,NBITS) | returns IWin IXwith the byte at Jreplaced by thebyte at |
JAof IA. | |
IX = JBYTET(IA,IW,J,NBITS) | returns in IXthe logical ANDof IAand the byte atJof IW |
right-justified. | |
IX = JBYTOR(IA,IW,J,NBITS) | returns in IXthe logical ORof IAand the byte atJof IW |
right-justified. | |
CALL SBYTOR(IA,IX,J,NBITS) | replaces the byte at Jin IXby the logical ORofthis byte |
and the byte at 1of IA. | |
IX = MBYTOR(IA,IW,J,NBITS | returns IWin IXwith the byte at Jreplaced by thelogical |
ORof this byte and the byte at 1of IA. | |
IX = MBYTET(IA,IW,J,NBITS) | returns IWin IXwith the byte at Jreplaced by thelogical |
ANDof this byte and the byte at 1of IA. | |
IY = JRSBYT(IA,IX,J,NBITS) | read and reset byte; equivalent to |
IY = JBYT(IX,J,NBITS) | |
CALL SBYT(IA,IX,J,NBITS). |
Notes:
The subroutines
SBIT0 SBIT1 SBIT SBYT CBYT SBYTORare duplicated by the functions
MSBIT0 MSBIT1 MSBIT MSBYT MCBYT MBYTORto allow implementation by statement functions. Such implementations can be picked up from the ZEBRA CDE Pam-file for different machines as sequence definitions
Q$JBIT : JBIT, JBYT Q$SBIT : MSBIT0, MSBIT1, MSBIT Q$SBYT : MSBYT Q$CBYT : MCBYT Q$JBYTET : JBYTET, JBYTOR, MBYTET, MBYTOR