Extracts a 4 bit nibble from a value.
NIBBLE(val, num, bitpos)
val |
- |
A scalar, series or table. |
num |
- |
Optional. An integer, the nibble to retrieve. Defaults to 1 (the first four bits). |
bitpos |
- |
Optional. An integer. Bit position. bitpos: 1 then num refers to starting LSB BIT position, else num refers to 4 bit nibble boundary. Defaults to 0. |
A series or number.
nibble(7+16)
Returns 7, the value of the first 4 bits.
nibble(7+16, 2)
Returns 1, the value of the second 4 bits.
nibble(7+16, 2, 1)
Returns 11, the value of the 4 bits starting at the 2nd bit, where the 2nd bit is the least significant bit - i.e. the value of bits 2 through 6.
Nibble also operates on series.
>> << & ~ bitor (Bit Operators)