algo

  • set rightmost unset bit: x | (x + 1)
  • unset rightmost set bit:x & (x - 1)