Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
25
Task/Bitwise-operations/PL-I/bitwise-operations.pli
Normal file
25
Task/Bitwise-operations/PL-I/bitwise-operations.pli
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
/* PL/I can perform bit operations on binary integers. */
|
||||
k = iand(i,j);
|
||||
k = ior(i,j);
|
||||
k = inot(i,j);
|
||||
k = ieor(i,j);
|
||||
k = isll(i,n); /* unsigned shifts i left by n places. */
|
||||
k = isrl(i,n); /* unsigned shifts i right by n places. */
|
||||
k = lower2(i, n); /* arithmetic right shift i by n places. */
|
||||
k = raise2(i, n); /* arithmetic left shift i by n places. */
|
||||
|
||||
/* PL/I can also perform boolean operations on bit strings */
|
||||
/* of any length: */
|
||||
|
||||
declare (s, t, u) bit (*);
|
||||
|
||||
u = s & t; /* logical and */
|
||||
u = s | t; /* logical or */
|
||||
u = ^ s; /* logical not */
|
||||
u = s ^ t; /* exclusive or */
|
||||
|
||||
/* Built-in rotate functions are not available. */
|
||||
/* They can be readily implemented by the user, though: */
|
||||
|
||||
u = substr(s, length(s), 1) || substr(s, 1, length(s)-1); /* implements rotate right. */
|
||||
u = substr(s, 2) || substr(s, 1, 1); /* implements rotate left. */
|
||||
Loading…
Add table
Add a link
Reference in a new issue