RosettaCodeData/Task/Bitwise-operations/XPL0/bitwise-operations.xpl0
Ingy döt Net d066446780 langs a-z
2013-04-10 22:43:41 -07:00

12 lines
657 B
Text

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);