RosettaCodeData/Task/Bitwise-operations/XPL0/bitwise-operations.xpl0

13 lines
657 B
Plaintext

Text(0, "A and B = "); HexOut(0, A and B); CrLf(0); \alternate symbol: &
Text(0, "A or B = "); HexOut(0, A or B); CrLf(0); \alternate symbol: !
Text(0, "A xor B = "); HexOut(0, A xor B); CrLf(0); \alternate symbol: |
Text(0, "not A = "); HexOut(0, not A); CrLf(0); \alternate symbol: ~
Text(0, "A << B = "); HexOut(0, A << B); CrLf(0);
Text(0, "A >> B logical = "); HexOut(0, A >> B); CrLf(0);
Text(0, "A >> B arithmetic = "); HexOut(0, A ->> B); CrLf(0);
\Rotate operations must be done by calling a function such as:
func ROR(A, B); int A, B; return A>>B ! A<<(32-B);
Text(0, "A ror B = "); HexOut(0, ROR(A,B)); CrLf(0);