AndyGable wrote: ↑Saturday 12th November 2022 12:51pm
So does anyone now the Gambas option for Bit?
What should Bit () do?
see my post above
Print BTst(0, 0) ........ prints false least significant bit is 0
Print BTst(1, 0) ........ returns True least significant bit is 1
Print BTst(2, 1) ..........returns True bit two is a 1
Function Description
BClr (Number, Bit) Returns number with deleted bit' Bit'.
BSet (Number, Bit) Returns number with bit' Bit' set.
BTst (Number, Bit) Returns True if bit' Bit' is set, otherwise False.
BChg (Number, Bit) Returns Number whose bit' Bit' was inverted.
Lsl (Number, Bit) Each bit in the bit sequence of Number is shifted to the left by' Bit' bits. For the left-hand bits that are omitted, zero bits are attached to the right-hand side. The sign is ignored. (Lsl = logical shift left)
Lsr (Number, Bit) Each bit in the bit sequence of Number is shifted to the right by' Bit' bits. Zero bits are inserted on the left for the bits that are omitted on the right. (Lsr = logical shift right)
Shl (Number, Bit) Each bit in the bit sequence of Number is shifted to the left by' Bit' bits. For the left-hand bits that are omitted, zero bits are attached to the right-hand side.
Asl (Count, Bit) Synonym for Shl (count, bit). The sign is not ignored.
Shr (Number, Bit) Each bit in the bit sequence of Number is shifted to the right by' Bit' bits. The sign bit is inserted on the left for the bits that are omitted on the right.
Asr (Number, Bit) Synonym for Shr (Number, Bit)
Rol (Number, Bit) During the operation Rol, the bits rotate by the number of' bits' as if MSB (most significant bit - highest value bit position) and LSB (less significant bit - lowest value bit position) were connected to each other. The bit that is shifted out of the bit sequence to the left has the same value as the bit that is shifted in from the right. (Rol = Rotate left)
Ror (Number, Bit) During operation Ror(), the bits rotate by the number of 'bits' as if MSB and LSB were connected to each other. The bit that is shifted out of the bit sequence to the right has the same value as the bit that is shifted in from the left.