CSC 270 - Survey of Programming Languages

Assignment #5 - Bitwise operations

Due Monday, October 9, 2017

  1. Write a function setbits(x, p, n, y) that returns x with the n bits that begins at position set to the rightmost n bit of y , leaving the other bits unchanged.
  2. Write a function rightrot(x, n) that returns the value of the integer x rotated to the right by n bit positions.

    [Back to the Assignments Index]