Stuart: Finally got to testing out your Flag code. There is a problem.

The Alloc routine finds the leftmost available bit, this creates the 'flag number'.

But BIT SET / RESET count the bit number from Right-to-Leftm modulo 'n', based on the definition of the BIT SET variable. So when you allocate a bit, BIT SET is not setting the same bit you just found.

So the alloc keeps finding the same bit over and over.

e.g. (Using a 16 bit variable)

Start X'0000' Alloc chooses Buffer 1, Flag=1

BIT SET var, Flag - 1

X'0001' Oops, buffer 32 is set

Alloc keeps assigning Flag = 1 forever.

So although BIT SET will handle bit numbers in the millions, it does not set the bits serially from MSB to LSB, but the other way around, for each item in the bit flag array.

We really need a BIT SET function to handle the bit number from left to right.

George

The Alloc routine finds the leftmost available bit, this creates the 'flag number'.

But BIT SET / RESET count the bit number from Right-to-Leftm modulo 'n', based on the definition of the BIT SET variable. So when you allocate a bit, BIT SET is not setting the same bit you just found.

So the alloc keeps finding the same bit over and over.

e.g. (Using a 16 bit variable)

Start X'0000' Alloc chooses Buffer 1, Flag=1

BIT SET var, Flag - 1

X'0001' Oops, buffer 32 is set

Alloc keeps assigning Flag = 1 forever.

So although BIT SET will handle bit numbers in the millions, it does not set the bits serially from MSB to LSB, but the other way around, for each item in the bit flag array.

We really need a BIT SET function to handle the bit number from left to right.

George

## Comment