Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
22
Task/Bitwise-operations/Modula-3/bitwise-operations.mod3
Normal file
22
Task/Bitwise-operations/Modula-3/bitwise-operations.mod3
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
MODULE Bitwise EXPORTS Main;
|
||||
|
||||
IMPORT IO, Fmt, Word;
|
||||
|
||||
VAR c: Word.T;
|
||||
|
||||
PROCEDURE Bitwise(a, b: INTEGER) =
|
||||
BEGIN
|
||||
IO.Put("a AND b: " & Fmt.Int(Word.And(a, b)) & "\n");
|
||||
IO.Put("a OR b: " & Fmt.Int(Word.Or(a, b)) & "\n");
|
||||
IO.Put("a XOR b: " & Fmt.Int(Word.Xor(a, b)) & "\n");
|
||||
IO.Put("NOT a: " & Fmt.Int(Word.Not(a)) & "\n");
|
||||
c := a;
|
||||
IO.Put("c LeftShift b: " & Fmt.Unsigned(Word.LeftShift(c, b)) & "\n");
|
||||
IO.Put("c RightShift b: " & Fmt.Unsigned(Word.RightShift(c, b)) & "\n");
|
||||
IO.Put("c LeftRotate b: " & Fmt.Unsigned(Word.LeftRotate(c, b)) & "\n");
|
||||
IO.Put("c RightRotate b: " & Fmt.Unsigned(Word.RightRotate(c, b)) & "\n");
|
||||
END Bitwise;
|
||||
|
||||
BEGIN
|
||||
Bitwise(255, 5);
|
||||
END Bitwise.
|
||||
Loading…
Add table
Add a link
Reference in a new issue