Sha256: 556b686c732b3d44773f030c5e2e2ce6cdb9f79626ae1e637f340fd8d2fc82dc
Contents?: true
Size: 426 Bytes
Versions: 4
Compression:
Stored size: 426 Bytes
Contents
# frozen_string_literal: true module TTFunk class BitField attr_reader :value def initialize(value = 0) @value = value end def on(pos) @value |= 2**pos end def on?(pos) value & 2**pos > 0 end def off(pos) @value &= 2**Math.log2(value).ceil - 2**pos - 1 end def off?(pos) !on?(pos) end def dup self.class.new(value) end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
ttfunk-1.6.2.1 | lib/ttfunk/bit_field.rb |
ttfunk-1.6.2 | lib/ttfunk/bit_field.rb |
ttfunk-1.6.1 | lib/ttfunk/bit_field.rb |
ttfunk-1.6.0 | lib/ttfunk/bit_field.rb |