Sage-ST ä

Bitlib

Documentation

BitAnd BitAndDWord BitAndWord BitAndWordEmpty
BitDif BitDifDWord BitDifWord BitKnt
BitKntDWord BitKntWord BitNot BitNotDWord
BitNotWord BitOr BitOrDWord BitOrWord
BitXor BitXorDWord BitXorWord ByteAnd
DWordAnd EXCL INCL Included
MaskLeft MaskRight ShiftLeftAround ShiftLeftOff
ShiftLeftOffArray ShiftRightAround ShiftRightOff ShiftRightOffArray
WordAnd




  PROCEDURE Included
             (CONST TheSet : ModSys.CARD16;
              CONST bit    : CARDINAL) : BOOLEAN;

  (**
      Included - Check if a bit is set.


      This procedure checks the setting of a bit within a word.

      CALLING SEQUENCE -

        b := Included (TheSet, bit);

      ENTRY -

        TheSet : CARDINAL
          The word containing the bit to be checked.

        bit : CARDINAL
          The number of the bit to check (0 .. 15).

      EXIT -

        b : BOOLEAN
          TRUE if 'bit' is set in 'set'.
  *)




  PROCEDURE Incl
             (VAR   TheSet : ModSys.CARD16;
              CONST bit    : CARDINAL);

  (**
      Incl - Set a bit within a word.


      This procedure sets a specified bit within a word.

      CALLING SEQUENCE -

        Incl (TheSet, bit);

      ENTRY -

        TheSet : CARDINAL
          The word containing the bit to be set.

        bit : CARDINAL
          The number of the bit to set (0 .. 15).

      EXIT -

        set : CARDINAL
          The word containing the set bit.
  *)




  PROCEDURE Excl
             (VAR   TheSet : ModSys.CARD16;
              CONST bit    : CARDINAL);

  (**
      Excl - Reset (set to 0) a bit within a word.


      This  procedure resets  (set to  0) a  specified bit within a
      word.

      CALLING SEQUENCE -

        Excl (TheSet, bit);

      ENTRY -

        TheSet : CARDINAL
          The word containing the bit to be reset.

        bit : CARDINAL
          The number of the bit to reset (0 .. 15).

      EXIT -

        None
          N/A
  *)




  PROCEDURE MaskLeft
             (CONST bits : CARDINAL) : ModSys.CARD16;

  (**
      MaskLeft - Return mask with specified number of left bits set.


      This procedure  returns a word  with the specified  number of
      left (higher order) bits set.

      For  example "set  :=  MaskLeft (3);"  returns 'set'  equal to
      0E0H.

      CALLING SEQUENCE -

        set := MaskLeft (bits);

      ENTRY -

        bits : CARDINAL
          The number of left bits to set.

      EXIT -

        set : CARDINAL
          The word containing 'bits' left bits set.
  *)




  PROCEDURE MaskRight
             (CONST bits : CARDINAL) : ModSys.CARD16;

  (**
      MaskRight - Return mask with specified right bits set.


      This procedure  returns a word  with the specified  number of
      right (lower order) bits set.

      For  example "set  := MaskRight (3);"  returns 'set'  equal to
      007H.

      CALLING SEQUENCE -

        set := MaskRight (bits);

      ENTRY -

        bits : CARDINAL
          The number of right bits to set.

      EXIT -

        set : CARDINAL
          The word containing 'bits' right bits set.
  *)




  PROCEDURE ShiftLeftOff
             (VAR   TheSet : ModSys.CARD16;
              CONST bits   : CARDINAL);

  (**
      ShiftLeftOff - Shift bits left without wrap around.


      This  procedure left  shifts a  word the  specified number of
      bits. In a left shift the  highest order bits are shifted off
      first. The right (lower order) bits are set to zero (0).

      CALLING SEQUENCE -

        ShiftLeftOff (set, bits);

      ENTRY -

        set : CARDINAL
          The word containing the bits to be shifted.

        bits : CARDINAL
          The number of bits to shift off (0 .. 16).

      EXIT -

        set : CARDINAL
          The original word with bits shifted.
  *)




  PROCEDURE ShiftRightOff
             (VAR   TheSet : ModSys.CARD16;
              CONST bits   : CARDINAL);

  (**
      ShiftRightoff - Shift bits right without wrap around.


      This procedure  right shifts a  word the specified  number of
      bits. In a right shift the  lowest order bits are shifted off
      first. The left (higher order) bits are set to zero (0).

      CALLING SEQUENCE -

        ShiftRightOff (TheSet, bits);

      ENTRY -

        TheSet : CARDINAL
          The word containing the bits to be shifted.

        bits : CARDINAL
          The number of bits to shift off (0 .. 16).

      EXIT -

        set : CARDINAL
          The original word with bits shifted.
  *)




  PROCEDURE ShiftLeftAround
             (VAR   TheSet : ModSys.CARD16;
              CONST bits   : CARDINAL);

  (**
      ShiftLeftAround - Shift bits left with wrap around.


      This procedure left shifts a word around the specified number
      of bits.  In a left shift  around the highest order  bits are
      shifted around to the right side (lower order bits).

      CALLING SEQUENCE -

        ShiftLeftAround (TheSet, bits);

      ENTRY -

        TheSet : CARDINAL
          The word containing the bits to be shifted.

        bits : CARDINAL
          The number of bits to shift around (0 .. 16).

      EXIT -

        set : CARDINAL
          The original word with bits shifted.
  *)




  PROCEDURE ShiftRightAround
             (VAR   TheSet : ModSys.CARD16;
              CONST bits   : CARDINAL);

  (**
      ShiftRightAround - Shift bits right with wrap around.


      This  procedure  right  shifts  a  word  around the specified
      number of bits. In a right shift around the lowest order bits
      are shifted around to the left side (higher order bits).

      CALLING SEQUENCE -

        ShiftRightAround (set, bits);

      ENTRY -

        set : CARDINAL
          The word containing the bits to be shifted.

        bits : CARDINAL
          The number of bits to shift around (0 .. 16).

      EXIT -

        set : CARDINAL
          The original word with bits shifted.
  *)




  PROCEDURE BitAnd
             (CONST bitsIn    : SYSTEM.ADDRESS;
              CONST bitsOut   : SYSTEM.ADDRESS;
              CONST bitLength : CARDINAL);

  (**
      BitAnd - Bit-wise AND two byte arrays.


      This procedure bit-wise ANDs  'bitLength' bytes from 'bitsIn'
      into bytes in 'bitsOut'.

      CALLING SEQUENCE -

        BitAnd (bitsIn, bitsOut, bitLength);

      ENTRY -

        bitsIn : SYSTEM.ADDRESS
          The address of the input array of bytes.

        bitsOut : SYSTEM.ADDRESS
          The address of the output array of bytes.

        bitLength : CARDINAL
          The number of bytes to AND.

      EXIT -

        bitsOut : SYSTEM.ADDRESS
          The array ANDed with the 'bitsIn' array.
  *)




  PROCEDURE BitAndWord
             (CONST bitsIn    : SYSTEM.ADDRESS;
              CONST bitsOut   : SYSTEM.ADDRESS;
              CONST bitLength : CARDINAL);

  (**
      BitAndWord - Bit-wise AND two word arrays.


      This procedure bit-wise ANDs  'bitLength' words from 'bitsIn'
      into words in 'bitsOut'.

      CALLING SEQUENCE -

        BitAndWord (bitsIn, bitsOut, bitLength);

      ENTRY -

        bitsIn : SYSTEM.ADDRESS
          The address of the input array of words.

        bitsOut : SYSTEM.ADDRESS
          The address of the output array of words.

        bitLength : CARDINAL
          The number of words to AND.

      EXIT -

        bitsOut : SYSTEM.ADDRESS
          The array ANDed with the 'bitsIn' array.
  *)




  PROCEDURE BitAndWordEmpty
             (CONST bitsIn    : SYSTEM.ADDRESS;
              CONST bitsOut   : SYSTEM.ADDRESS;
              CONST bitLength : CARDINAL) : BOOLEAN;

  (**
      BitAndWordEmpty - Bit-wise AND two word arrays, return empty status.


      This procedure bit-wise ANDs  'bitLength' words from 'bitsIn'
      into words in 'bitsOut', and returns the empty status.

      CALLING SEQUENCE -

        empty := BitAndWordEmpty (bitsIn, bitsOut, bitLength);

      ENTRY -

        bitsIn : SYSTEM.ADDRESS
          The address of the input array of words.

        bitsOut : SYSTEM.ADDRESS
          The address of the output array of words.

        bitLength : CARDINAL
          The number of words to AND.

      EXIT -

        empty : BOOLEAN
          TRUE if the  ANDed 'bitsOut' array is empty  (has no bits
          set).

        bitsOut : SYSTEM.ADDRESS
          The array ANDed with the 'bitsIn' array.
  *)




  PROCEDURE BitOr
             (CONST bitsIn    : SYSTEM.ADDRESS;
              CONST bitsOut   : SYSTEM.ADDRESS;
              CONST bitLength : CARDINAL);

  (**
      BitOr - Bit-wise OR two byte arrays.


      This procedure  bit-wise ORs 'bitLength'  bytes from 'bitsIn'
      into bytes in 'bitsOut'.

      CALLING SEQUENCE -

        BitOr (bitsIn, bitsOut, bitLength);

      ENTRY -

        bitsIn : SYSTEM.ADDRESS
          The address of the input array of bytes.

        bitsOut : SYSTEM.ADDRESS
          The address of the output array of bytes.

        bitLength : CARDINAL
          The number of bytes to OR.

      EXIT -

        bitsOut : SYSTEM.ADDRESS
          The array ORed with the 'bitsIn' array.
  *)




  PROCEDURE BitOrWord
             (CONST bitsIn    : SYSTEM.ADDRESS;
              CONST bitsOut   : SYSTEM.ADDRESS;
              CONST bitLength : CARDINAL);

  (**
      BitOrWord - Bit-wise OR two word arrays.


      This procedure  bit-wise ORs 'bitLength'  words from 'bitsIn'
      into words in 'bitsOut'.

      CALLING SEQUENCE -

        BitOrWord (bitsIn, bitsOut, bitLength);

      ENTRY -

        bitsIn : SYSTEM.ADDRESS
          The address of the input array of words.

        bitsOut : SYSTEM.ADDRESS
          The address of the output array of words.

        bitLength : CARDINAL
          The number of words to OR.

      EXIT -

        bitsOut : SYSTEM.ADDRESS
          The array ORed with the 'bitsIn' array.
  *)




  PROCEDURE BitDif
             (CONST bitsIn    : SYSTEM.ADDRESS;
              CONST bitsOut   : SYSTEM.ADDRESS;
              CONST bitLength : CARDINAL);

  (**
      BitDif - Bit-wise AND one byte array with the NOT of another.


      This procedure bit-wise ANDs 'bitLength' bytes into 'bitsOut'
      with the NOT of bytes from 'bitsIn'.

      CALLING SEQUENCE -

        BitDif (bitsIn, bitsOut, bitLength);

      ENTRY -

        bitsIn : SYSTEM.ADDRESS
          The address of the input array of bytes.

        bitsOut : SYSTEM.ADDRESS
          The address of the output array of bytes.

        bitLength : CARDINAL
          The number of bytes to process.

      EXIT -

        bitsOut : SYSTEM.ADDRESS
          The array  ANDed with  the NOT  of the  'bitsIn'
          array.
  *)




  PROCEDURE BitDifWord
             (CONST bitsIn    : SYSTEM.ADDRESS;
              CONST bitsOut   : SYSTEM.ADDRESS;
              CONST bitLength : CARDINAL);

  (**
      BitDifWord - Bit-wise AND one word array with the NOT of another.


      This procedure bit-wise ANDs 'bitLength' words into 'bitsOut'
      with the NOT of words from 'bitsIn'.

      CALLING SEQUENCE -

        BitDifWord (bitsIn, bitsOut, bitLength);

      ENTRY -

        bitsIn : SYSTEM.ADDRESS
          The address of the input array of words.

        bitsOut : SYSTEM.ADDRESS
          The address of the output array of words.

        bitLength : CARDINAL
          The number of words to process.

      EXIT -

        bitsOut : SYSTEM.ADDRESS
          The array  ANDed with  the NOT  of the  'bitsIn'
          array.
  *)




  PROCEDURE BitXor
             (CONST bitsIn    : SYSTEM.ADDRESS;
              CONST bitsOut   : SYSTEM.ADDRESS;
              CONST bitLength : CARDINAL);

  (**
      BitXor - Bit-wise XOR two byte arrays.


      This procedure bit-wise XORs  'bitLength' bytes from 'bitsIn'
      into bytes in 'bitsOut'.

      CALLING SEQUENCE -

        BitXor (bitsIn, bitsOut, bitLength);

      ENTRY -

        bitsIn : SYSTEM.ADDRESS
          The address of the input array of bytes.

        bitsOut : SYSTEM.ADDRESS
          The address of the output array of bytes.

        bitLength : CARDINAL
          The number of bytes to XOR.

      EXIT -

        bitsOut : SYSTEM.ADDRESS
          The array XORed with the 'bitsIn' array.
  *)




  PROCEDURE BitXorWord
             (CONST bitsIn    : SYSTEM.ADDRESS;
              CONST bitsOut   : SYSTEM.ADDRESS;
              CONST bitLength : CARDINAL);

  (**
      BitXorWord - Bit-wise XOR two word arrays.


      This procedure bit-wise XORs  'bitLength' words from 'bitsIn'
      into words in 'bitsOut'.

      CALLING SEQUENCE -

        BitXorWord (bitsIn, bitsOut, bitLength);

      ENTRY -

        bitsIn : SYSTEM.ADDRESS
          The address of the input array of words.

        bitsOut : SYSTEM.ADDRESS
          The address of the output array of words.

        bitLength : CARDINAL
          The number of words to XOR.

      EXIT -

        bitsOut : SYSTEM.ADDRESS
          The array XORed with the 'bitsIn' array.
  *)




  PROCEDURE BitNot
             (CONST bitsOut   : SYSTEM.ADDRESS;
              CONST bitLength : CARDINAL);

  (**
      BitNot - Bit-wise NOT a byte array.


      This procedure bit-wise NOTs 'bitLength' bytes in 'bitsOut'.

      CALLING SEQUENCE -

        BitNot (bitsOut, bitLength);

      ENTRY -

        bitsOut : SYSTEM.ADDRESS
          The address of the output array of bytes.

        bitLength : CARDINAL
          The number of bytes to NOT.

      EXIT -

        bitsOut : SYSTEM.ADDRESS
          The array NOTed.
  *)




  PROCEDURE BitNotWord
             (CONST bitsOut   : SYSTEM.ADDRESS;
              CONST bitLength : CARDINAL);

  (**
      BitNotWord - Bit-wise NOT a word array.


      This procedure bit-wise NOTs 'bitLength' words in 'bitsOut'.

      CALLING SEQUENCE -

        BitNotWord (bitsOut, bitLength);

      ENTRY -

        bitsOut : SYSTEM.ADDRESS
          The address of the output array of words.

        bitLength : CARDINAL
          The number of words to NOT.

      EXIT -

        bitsOut : SYSTEM.ADDRESS
          The array NOTed.
  *)




  PROCEDURE BitKnt
             (CONST bitsIn    : SYSTEM.ADDRESS;
              CONST bitLength : CARDINAL) : CARDINAL;

  (**
      BitKnt - Count the set bits in a byte array.


      This procedure  counts the set  bits in 'bitLength'  bytes of
      'bitsIn'.

      CALLING SEQUENCE -

        count := BitKnt (bitsIn, bitLength);

      ENTRY -

        bitsIn : SYSTEM.ADDRESS
          The address of the input array of bytes.

        bitLength : CARDINAL
          The number of bytes to count.

      EXIT -

        count : CARDINAL
          The number of bits set in the array.
  *)




  PROCEDURE BitKntWord
             (CONST bitsIn    : SYSTEM.ADDRESS;
              CONST bitLength : CARDINAL) : CARDINAL;

  (**
      BitKntWord - Count the set bits in a word array.


      This procedure  counts the set  bits in 'bitLength'  words of
      'bitsIn'.

      CALLING SEQUENCE -

        count := BitKntWord (bitsIn, bitLength);

      ENTRY -

        bitsIn : SYSTEM.ADDRESS
          The address of the input array of words.

        bitLength : CARDINAL
          The number of words to count.

      EXIT -

        count : CARDINAL
          The number of bits set in the array.
  *)




  PROCEDURE ByteAnd
             (CONST char1 : CHAR;
              CONST char2 : CHAR) : CHAR;

  (**
      ByteAnd - AND two bytes together returning the result.


      This procedure bit-wise ANDs two bytes and returns the result.

      CALLING SEQUENCE -

        ANDedByte := ByteAnd (char1, char2);

      ENTRY -

        char1, char2 : CHAR
          The two bytes to be ANDed.

      EXIT -

        ANDedByte : CHAR
          The result of ANDing the two bytes.
  *)




  PROCEDURE WordAnd
             (CONST word1 : ModSys.CARD16;
              CONST word2 : ModSys.CARD16) : ModSys.CARD16;

  (**
      WordAnd - AND two words together returning the result.


      This procedure bit-wise ANDs two words and returns the result.

      CALLING SEQUENCE -

        ANDedWord := WordAnd (word1, word2);

      ENTRY -

        char1, char2 : CARDINAL
          The two words to be ANDed.

      EXIT -

        ANDedWord : CARDINAL
          The result of ANDing the two words.
  *)




  PROCEDURE ShiftLeftOffArray
             (CONST TheSet   : SYSTEM.ADDRESS;
              CONST setBytes : CARDINAL;
              CONST bits     : CARDINAL);

  (**
      ShiftLeftOffArray - Shift array of bits left without wrap around.


      This procedure left shifts an array of bytes the specified number
      of bits. In a left shift the  highest order bits are shifted off
      first. The right (lower order) bits are set to zero (0).

      CALLING SEQUENCE -

        ShiftLeftOffArray (TheSet, setBytes, bits);

      ENTRY -

        TheSet : SYSTEM.ADDRESS
          The address of the array of bytes containing the bits to
          be shifted.

        setBytes : CARDINAL
          The number of bytes in the array to be shifted.

        bits : CARDINAL
          The number of bits to shift off.

      EXIT -

        set : SYSTEM.ADDRESS
          The original array with bits shifted.
  *)




  PROCEDURE ShiftRightOffArray
             (CONST TheSet   : SYSTEM.ADDRESS;
              CONST setBytes : CARDINAL;
              CONST bits     : CARDINAL);

  (**
      ShiftRightOffArray - Shift array of bits right without wrap around.


      This procedure right shifts an array of bytes the specified number
      of bits. In a right shift the  lowest order bits are shifted off
      first. The left (higher order) bits are set to zero (0).

      CALLING SEQUENCE -

        ShiftRightOffArray (set, setBytes, bits);

      ENTRY -

        set : SYSTEM.ADDRESS
          The address of the array of bytes containing the bits to
          be shifted.

        setBytes : CARDINAL
          The number of bytes in the array to be shifted.

        bits : CARDINAL
          The number of bits to shift off.

      EXIT -

        set : SYSTEM.ADDRESS
          The original array with bits shifted.
  *)




  PROCEDURE BitAndDWord
             (CONST bitsIn    : SYSTEM.ADDRESS;
              CONST bitsOut   : SYSTEM.ADDRESS;
              CONST bitLength : CARDINAL);

  (**
      BitAndDWord - Bit-wise AND two dword arrays.


      This procedure bit-wise ANDs  'bitLength' dwords from 'bitsIn'
      into dwords in 'bitsOut'.

      CALLING SEQUENCE -

        BitAndDWord (bitsIn, bitsOut, bitLength);

      ENTRY -

        bitsIn : SYSTEM.ADDRESS
          The address of the input array of dwords.

        bitsOut : SYSTEM.ADDRESS
          The address of the output array of dwords.

        bitLength : CARDINAL
          The number of dwords to AND.

      EXIT -

        bitsOut : SYSTEM.ADDRESS
          The array ANDed with the 'bitsIn' array.
  *)




  PROCEDURE BitOrDWord
             (CONST bitsIn    : SYSTEM.ADDRESS;
              CONST bitsOut   : SYSTEM.ADDRESS;
              CONST bitLength : CARDINAL);

  (**
      BitOrDWord - Bit-wise OR two dword arrays.


      This procedure  bit-wise ORs 'bitLength'  dwords from 'bitsIn'
      into dwords in 'bitsOut'.

      CALLING SEQUENCE -

        BitOrDWord (bitsIn, bitsOut, bitLength);

      ENTRY -

        bitsIn : SYSTEM.ADDRESS
          The address of the input array of dwords.

        bitsOut : SYSTEM.ADDRESS
          The address of the output array of dwords.

        bitLength : CARDINAL
          The number of dwords to OR.

      EXIT -

        bitsOut : SYSTEM.ADDRESS
          The array ORed with the 'bitsIn' array.
  *)




  PROCEDURE BitDifDWord
             (CONST bitsIn    : SYSTEM.ADDRESS;
              CONST bitsOut   : SYSTEM.ADDRESS;
              CONST bitLength : CARDINAL);

  (**
      BitDifDWord - Bit-wise AND one dword array with the NOT of another.


      This procedure bit-wise ANDs 'bitLength' dwords into 'bitsOut'
      with the NOT of dwords from 'bitsIn'.

      CALLING SEQUENCE -

        BitDifDWord (bitsIn, bitsOut, bitLength);

      ENTRY -

        bitsIn : SYSTEM.ADDRESS
          The address of the input array of dwords.

        bitsOut : SYSTEM.ADDRESS
          The address of the output array of dwords.

        bitLength : CARDINAL
          The number of dwords to process.

      EXIT -

        bitsOut : SYSTEM.ADDRESS
          The array  ANDed with  the NOT  of the  'bitsIn'
          array.
  *)




  PROCEDURE BitXorDWord
             (CONST bitsIn    : SYSTEM.ADDRESS;
              CONST bitsOut   : SYSTEM.ADDRESS;
              CONST bitLength : CARDINAL);

  (**
      BitXorDWord - Bit-wise XOR two dword arrays.


      This procedure bit-wise XORs  'bitLength' dwords from 'bitsIn'
      into dwords in 'bitsOut'.

      CALLING SEQUENCE -

        BitXorDWord (bitsIn, bitsOut, bitLength);

      ENTRY -

        bitsIn : SYSTEM.ADDRESS
          The address of the input array of dwords.

        bitsOut : SYSTEM.ADDRESS
          The address of the output array of dwords.

        bitLength : CARDINAL
          The number of dwords to XOR.

      EXIT -

        bitsOut : SYSTEM.ADDRESS
          The array XORed with the 'bitsIn' array.
  *)




  PROCEDURE BitNotDWord
             (CONST bitsOut   : SYSTEM.ADDRESS;
              CONST bitLength : CARDINAL);

  (**
      BitNotDWord - Bit-wise NOT a dword array.


      This procedure bit-wise NOTs 'bitLength' dwords in 'bitsOut'.

      CALLING SEQUENCE -

        BitNotDWord (bitsOut, bitLength);

      ENTRY -

        bitsOut : SYSTEM.ADDRESS
          The address of the output array of dwords.

        bitLength : CARDINAL
          The number of dwords to NOT.

      EXIT -

        bitsOut : SYSTEM.ADDRESS
          The array NOTed.
  *)




  PROCEDURE BitKntDWord
             (CONST bitsIn    : SYSTEM.ADDRESS;
              CONST bitLength : CARDINAL) : CARDINAL;

  (**
      BitKntDWord - Count the set bits in a dword array.


      This procedure  counts the set  bits in 'bitLength'  dwords of
      'bitsIn'.

      CALLING SEQUENCE -

        count := BitKntDWord (bitsIn, bitLength);

      ENTRY -

        bitsIn : SYSTEM.ADDRESS
          The address of the input array of dwords.

        bitLength : CARDINAL
          The number of dwords to count.

      EXIT -

        count : CARDINAL
          The number of bits set in the array.
  *)




  PROCEDURE DWordAnd
             (CONST dword1 : CARDINAL;
              CONST dword2 : CARDINAL) : CARDINAL;

  (**
      DWordAnd - AND two dwords together returning the result.


      This procedure bit-wise ANDs two dwords and returns the result.

      CALLING SEQUENCE -

        ANDedDWord := DWordAnd (dword1, dword2);

      ENTRY -

        dword1, dword2 : CARDINAL
          The two dwords to be ANDed.

      EXIT -

        ANDedWord : CARDINAL
          The result of ANDing the two dwords.
  *)




Send mail to   warren.merrill@inl.gov with questions or comments about this web site.
Copyright © 1989-2006 Battelle Energy Alliance