We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 8c18b85 commit aaf0693Copy full SHA for aaf0693
lib/bitarray.rb
@@ -49,7 +49,7 @@ def each_byte
49
# Returns the total number of bits that are set
50
# (The technique used here is about 6 times faster than using each or inject direct on the bitfield)
51
def total_set
52
- each_byte.inject(0) { |a, byte| a += byte & 1 and byte >>= 1 until byte == 0; a }
+ @field.bytes.inject(0) { |a, byte| a += byte & 1 and byte >>= 1 until byte == 0; a }
53
end
54
55
def byte_position(position)
0 commit comments