19 lines
321 B
Plaintext
19 lines
321 B
Plaintext
with(Bits):
|
|
bit:=proc(A,B)
|
|
local a,b,c,d,e,f,g,h,i,x,bitpow;
|
|
bitpow := 2^B:
|
|
a:=And(A,B);
|
|
b:=Not(A);
|
|
c:=Or(A,B);
|
|
d:=Xor(A,B);
|
|
#Left Shift
|
|
e:= irem(2*A,bitpow);
|
|
#Right Shift
|
|
f := iquo(A,2);
|
|
#Left Rotate
|
|
g:= irem(2*A,bitpow,'x')+x;
|
|
#Rightarithshift
|
|
i:= iquo(A,2)+bitpow/2*irem(A,bitpow/2);
|
|
return a,b,c,d,e,f,g,i;
|
|
end proc;
|