[ << ] [ < ] [ Up ] [ > ] [ >> ] [Top] [Contents] [Index] [ ? ]

6.2 Bit operations

 [ << ] [ < ] [ Up ] [ > ] [ >> ] [Top] [Contents] [Index] [ ? ]

6.2.1 `iand`, `ior`, `ixor`

iand(i1,i2)

:: bitwise and

ior(i1,i2)

:: bitwise or

ixor(i1,i2)

:: bitwise xor

return

integer

i1 i2

integer

• The absolute value of the argument is regarded as a bit string.
• The sign of the argument is ignored and a non-negative integer is returned.
```[0] ctrl("hex",1);
0x1
[1] iand(0xeeeeeeeeeeeeeeee,0x2984723234812312312);
0x4622224802202202
[2] ior(0xa0a0a0a0a0a0a0a0,0xb0c0b0b0b0b0b0b);
0xabacabababababab
[3] ixor(0xfffffffffff,0x234234234234);
0x2cbdcbdcbdcb
```
References

 [ << ] [ < ] [ Up ] [ > ] [ >> ] [Top] [Contents] [Index] [ ? ]

6.2.2 `ishift`

ishift(i,count)

:: bit shift

return

integer

i count

integer

• The absolute value of i is regarded as a bit string.
• The sign of i is ignored and a non-negative integer is returned.
• If count is positive, then i is shifted to the right. If count is negative, then i is shifted to the left.
```[0] ctrl("hex",1);
0x1
[1] ishift(0x1000000,12);
0x1000
[2] ishift(0x1000,-12);
0x1000000
[3] ixor(0x1248,ishift(1,-16)-1);
```
References

 [ << ] [ < ] [ Up ] [ > ] [ >> ]

This document was generated on December 1, 2023 using texi2html 5.0.