Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
29
Task/Bitwise-operations/ECL/bitwise-operations.ecl
Normal file
29
Task/Bitwise-operations/ECL/bitwise-operations.ecl
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
BitwiseOperations(INTEGER A, INTEGER B) := FUNCTION
|
||||
BitAND := A & B;
|
||||
BitOR := A | B;
|
||||
BitXOR := A ^ B;
|
||||
BitNOT := BNOT A;
|
||||
BitSL := A << B;
|
||||
BitSR := A >> B;
|
||||
DS := DATASET([{A,B,'Bitwise AND:',BitAND},
|
||||
{A,B,'Bitwise OR:',BitOR},
|
||||
{A,B,'Bitwise XOR',BitXOR},
|
||||
{A,B,'Bitwise NOT A:',BitNOT},
|
||||
{A,B,'ShiftLeft A:',BitSL},
|
||||
{A,B,'ShiftRight A:',BitSR}],
|
||||
{INTEGER AVal,INTEGER BVal,STRING15 valuetype,INTEGER val});
|
||||
RETURN DS;
|
||||
END;
|
||||
|
||||
BitwiseOperations(255,5);
|
||||
//right arithmetic shift, left and right rotate not implemented
|
||||
/*
|
||||
OUTPUT:
|
||||
255 5 Bitwise AND: 5
|
||||
255 5 Bitwise OR: 255
|
||||
255 5 Bitwise XOR 250
|
||||
255 5 Bitwise NOT A: -256
|
||||
255 5 ShiftLeft A: 8160
|
||||
255 5 ShiftRight A: 7
|
||||
|
||||
*/
|
||||
Loading…
Add table
Add a link
Reference in a new issue