Re: Inconsistent String Behavior
Posted: Sat Dec 20, 2014 9:20 am
this is the class I use for Bitmask, it take only 199 byte space to store 1024 bit in the string preset
Edit: some correction
Code: Select all
class Bitmask
def initialize
@mask = 0
end
def set idx
@mask |= 1 << idx
end
def unset idx
@mask &= ~(1 << idx)
end
def get idx
@mask & (1 << idx) > 0
end
def clear
@mask = 0
end
def save
@mask.to_s(36)
end
def load data
@mask = data.to_i(36)
end
end
Edit: some correction