Skip to content

Instantly share code, notes, and snippets.

@acdimalev
Created April 5, 2010 18:16
Show Gist options
  • Save acdimalev/356668 to your computer and use it in GitHub Desktop.
Save acdimalev/356668 to your computer and use it in GitHub Desktop.
class Fixnum
def split(bits, count)
array = []
value = ord
mask = (1 << bits) - 1
count.times do
array << (value & mask)
value = value >> bits
end
array
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment