rshift (value shiftCount -- shiftedValue)shiftedValue: Right-shift result in the same schema.rshift consumes two Whole values. value provides the bits to shift and the schema of the result. shiftCount provides the shift amount and may use a different Whole schema.
The bits of value move to the right. The result always keeps the same schema as value.
shiftCount uses an Int schema, its bit pattern is first reinterpreted as the matching Nat width. Non-negative Int shift counts therefore behave the same as equal-valued Nat shift counts.-1 31 rshift therefore still produces -1.value is known zero, the result is known zero even when shiftCount is unknown.value.{} () {} [
"-- nat32 --" printCompilerMessage
12n32 2 rshift printStack _:;
12n32 1i8 rshift printStack _:;
"-- nat8 high bits --" printCompilerMessage
0x80n8 1 rshift printStack _:;
"-- zero and unknown shift --" printCompilerMessage
unknownShift: 0n32 dynamic;
0n32 unknownShift rshift printStack _:;
"-- unknown value and zero shiftCount --" printCompilerMessage
unknownNat: 0n32 dynamic;
unknownNat 0 rshift printStack _:;
"-- int32 --" printCompilerMessage
-4 1 rshift printStack _:;
-1 31 rshift printStack _:;
1 31 rshift printStack _:;
] "main" exportFunction
-- nat32 --
3n32
6n32
-- nat8 high bits --
64n8
-- zero and unknown shift --
0n32
-- unknown value and zero shiftCount --
Nat32
-- int32 --
-2
-1
0
and builtin (leftOperand rightOperand -- combinedValue) Combines two Cond or Whole values with bitwise or logical AND semantics.lshift builtin (value shiftCount -- shiftedValue) Performs a bitwise left shift on a Whole value and keeps the same schema.or builtin (leftOperand rightOperand -- combinedValue) Combines two Cond or Whole values with bitwise or logical OR semantics.xor builtin (leftOperand rightOperand -- combinedValue) Combines two Cond or Whole values with logical exclusive-OR or bitwise XOR semantics.~ builtin (value -- invertedValue) Performs logical NOT for Cond or bitwise complement for a Whole value.