MAINSAIL Language Manual, Section 31.9

previous   next   top   contents   index   framed top   this page unframed


31.9. bMask

Figure 31–8. bMask
COMPILETIME
BITS
PROCEDURE   bMask       (INTEGER lowBit,highBit);

bMask makes a bit mask, which is a contiguous sequence of 1-bits embedded within 0-bits.

bMask returns a BITS that consists of 1-bits in the bit positions from lowBit to highBit, and 0-bits everywhere else. The bits are numbered from right to left starting with 0.

If b is a BITS with all bits equal to 1-bit, then the result is the same as (b SHL lowBit) CLR (b SHL (highBit + 1)). The result is undefined if either lowBit or highBit is less than 0 or greater than or equal to the number of bits in a BITS, and the result is '0 if 0 LEQ highBit < lowBit.

lbMask (see Section 40.5) provides the same function for LONG BITS.

A garbage collection cannot occur during a call to bMask.

Example 31–9. Use of bMask
bMask(3,8) = 'B111111000
bMask(0,0) = 'B1
bMask(1,0) = '0


previous   next   top   contents   index   framed top   this page unframed

MAINSAIL Language Manual, Section 31.9