Bits operators (The GNU Algol 68 Compiler)

### 6.11 Bits operators ¶

#### 6.11.1 Logical ¶

Operator: NOT `= (l bits a, b) l bits` ¶
Operator: ~ `= (l bits a, b) l bits` ¶

  Monadic operator that yields the element-wise not logical operation in the elements of the given bits operand.

Operator: AND `= (l bits a, b) l bits` ¶
Operator: & `= (l bits a, b) l bits` ¶

  Dyadic operator that yields the element-wise and logical operation in the elements of the given bits operands.

Operator: OR `= (l bits a, b) l bits` ¶

  Dyadic operator that yields the element-wise “or” logical operation in the elements of the given bits operands.

#### 6.11.2 Shifting ¶

Operator: SHL `= (l bits a, int n) l bits` ¶
Operator: UP `= (l bits a, int n) l bits` ¶

  Dyadic operator that yields the given bits operand shifted `ABS n` positions to the left if `n >= 0` or `ABS n` positions to the right if `n < 0`. Extra elements introduced on the right or left are initialized to `false`. If `ABS n > L_bits_width` then the resulting bits value has all bits set to `false`.

Operator: SHR `= (l bits a, int n) l bits` ¶
Operator: DOWN `= (l bits a, int n) l bits` ¶

  Dyadic operator that yields the given bits operand shifted `ABS n` positions to the right if `n >= 0` or `ABS n` positions to the left if `n < 0`. Extra elements introduced on the right or left are initialized to `false`. If `ABS n > L_bits_width` then the resulting bits value has all bits set to `false`.

#### 6.11.3 Relational ¶

Operator: eq `= (l bits a, b) bool` ¶
Operator: = `= (l bits a, b) bool` ¶

  Dyadic operator that yields whether its operands are equal. Two bits are equal if they contain the same sequence of booleans.

Operator: ne `= (l bits a, b) bool` ¶
Operator: /= `= (l bits a, b) bool` ¶

  Dyadic operator that yields whether its operands are not equal.

Operator: lt `= (l bits a, b) bool` ¶
Operator: < `= (l bits a, b) bool` ¶

  Dyadic operator that yields whether the bits `a` is less than the bits `b`.

Operator: le `= (l bits a, b) bool` ¶
Operator: <= `= (l bits a, b) bool` ¶

  Dyadic operator that yields whether the bits `a` is less than, or equal to bits `b`.

Operator: gt `= (l bits a, b) bool` ¶
Operator: > `= (l bits a, b) bool` ¶

  Dyadic operator that yields whether the bits `a` is greater than the bits `b`.

Operator: ge `= (l bits a, b) bool` ¶
Operator: >= `= (l bits a, b) bool` ¶

  Dyadic operator that yields whether the bits `a` is greater than, or equal to the bits `b`.

#### 6.11.4 Conversions ¶

Operator: abs `= (l bits a) l int` ¶

  Monadic operator that yields the integral value whose constituent bits correspond to the booleans stored in `a`. See `bin` and `abs` of negative integral values.

Operator: bin `= (l int a) l bits` ¶

  Monadic operator that yields the bits value whose boolean elements map the bits in the given integral operand. See `bin` and `abs` of negative integral values.

Operator: shorten `= (long bits a) bits` ¶
Operator: shorten `= (long long bits a) long bits` ¶

  Monadic operator that yields the bits value that can be lengthened to the value of `a`.

Operator: leng `= (bits a) long bits` ¶
Operator: leng `= (long bits a) long long bits` ¶

  Monadic operator that yields the bits value lengthened from the value of `a`. The lengthened value features `false` in the extra left positions added to match the lengthened size.