Skip to content

Instantly share code, notes, and snippets.

@advorak
Created August 25, 2016 06:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save advorak/aee9b55574dc0ad272fab6334a225b27 to your computer and use it in GitHub Desktop.
Save advorak/aee9b55574dc0ad272fab6334a225b27 to your computer and use it in GitHub Desktop.
bitwise
starting_point = 0b11011101
ending_point = 0b10111001
bits_to_change = starting_point ^ ending_point #=> "0b01100100"
on_bits = ending_point & bits_to_change #=> "0b00100000"
off_bits = starting_point & bits_to_change#=> "0b01000100"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment