E.g. if (170 decimal) and
(167 decimal) and
and
say then you need to strip off 3 bits of y (111) and put them in x at
position
to get answer
.
Your answer should print out the result in binary form (see
Exercise although input can be in decimal form.
Your output should be like this:
x = 10101010 (binary) y = 10100111 (binary) setbits n = 3, p = 6 gives x = 10111010 (binary)
(unit7:functions:bits)
Your answer should print out the result in binary form (see
Exercise although input can be in decimal form.
Your output should be like this:
x = 10101010 (binary) x inverted = 01010101 (binary)
(unit7:functions:inv)
Your answer should print out the result in binary form (see
Exercise although input can be in decimal form.
Your output should be like this:
x = 10100111 (binary) x rotated by 3 = 11110100 (binary)
(unit7:functions:rot)
Note: All the functions developed should be as concise as possible