March 2018
Beginner to intermediate
416 pages
9h 24m
English
This function returns the value of val, shifted to the right side by the count number of bits specified in the argument. 0s are shifted in from the left side. For example, let us right shift the decimal 5 once time to show how the rshift() function works:
5 = 101
rshift once = 010 which is decimal 2
The following example shows how the rshift() functions work:
$ vi rshift.awkBEGIN { num1 = 5 count =1 result = rshift(num1,count) printf "rshift(%d,%d) = %d\n", num1, count, result}$ awk -f rshift.awk
The output of the execution of the previous code is as follows:
rshift(5,1) = 2
Read now
Unlock full access