RosettaCodeData/Task/Bitwise-operations/AWK/bitwise-operations.awk

11 lines
302 B
Awk
Raw Permalink Normal View History

2023-07-01 11:58:00 -04:00
BEGIN {
n = 11
p = 1
print n " or " p " = " or(n,p)
print n " and " p " = " and(n,p)
print n " xor " p " = " xor(n,p)
print n " << " p " = " lshift(n, p) # left shift
print n " >> " p " = " rshift(n, p) # right shift
printf "not %d = 0x%x\n", n, compl(n) # bitwise complement
}