Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
30
Task/Bitwise-operations/Seed7/bitwise-operations.seed7
Normal file
30
Task/Bitwise-operations/Seed7/bitwise-operations.seed7
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
$ include "seed7_05.s7i";
|
||||
include "bin32.s7i";
|
||||
|
||||
const proc: bitwise (in integer: a, in integer: b) is func
|
||||
begin
|
||||
writeln("a: " <& a radix 2 lpad0 32);
|
||||
writeln("b: " <& b radix 2 lpad0 32);
|
||||
writeln("integer operations:");
|
||||
writeln("a << b: " <& a << b radix 2 lpad0 32); # left shift
|
||||
writeln("a >> b: " <& a >> b radix 2 lpad0 32); # arithmetic right shift
|
||||
end func;
|
||||
|
||||
const proc: bitwise (in bin32: a, in bin32: b) is func
|
||||
begin
|
||||
writeln("bin32 operations:");
|
||||
writeln("a and b: " <& a & b radix 2 lpad0 32);
|
||||
writeln("a or b: " <& a | b radix 2 lpad0 32);
|
||||
writeln("a xor b: " <& a >< b radix 2 lpad0 32);
|
||||
writeln("not a: " <& ~a radix 2 lpad0 32);
|
||||
writeln("a << b: " <& a << ord(b) radix 2 lpad0 32); # left shift
|
||||
writeln("a >> b: " <& a >> ord(b) radix 2 lpad0 32); # logical right shift
|
||||
writeln("a rotL b: " <& rotLeft(a, ord(b)) radix 2 lpad0 32); # Rotate Left
|
||||
writeln("a rolR b: " <& rotRight(a, ord(b)) radix 2 lpad0 32); # Rotate Right
|
||||
end func;
|
||||
|
||||
const proc: main is func
|
||||
begin
|
||||
bitwise(65076, 6);
|
||||
bitwise(bin32(65076), bin32(6));
|
||||
end func;
|
||||
Loading…
Add table
Add a link
Reference in a new issue