File tree Expand file tree Collapse file tree 3 files changed +3
-3
lines changed Expand file tree Collapse file tree 3 files changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -45,6 +45,6 @@ def each_byte
4545 # Returns the total number of bits that are set
4646 # (The technique used here is about 6 times faster than using each or inject direct on the bitfield)
4747 def total_set
48- @field . inject ( 0 ) { |a , byte | a += byte & 1 and byte >>= 1 until byte == 0 ; a }
48+ @field . each_byte . inject ( 0 ) { |a , byte | a += byte & 1 and byte >>= 1 until byte == 0 ; a }
4949 end
5050end
Original file line number Diff line number Diff line change @@ -49,7 +49,7 @@ def each_byte
4949 # Returns the total number of bits that are set
5050 # (The technique used here is about 6 times faster than using each or inject direct on the bitfield)
5151 def total_set
52- @field . bytes . inject ( 0 ) { |a , byte | a += byte & 1 and byte >>= 1 until byte == 0 ; a }
52+ @field . each_byte . inject ( 0 ) { |a , byte | a += byte & 1 and byte >>= 1 until byte == 0 ; a }
5353 end
5454
5555 def byte_position ( position )
Original file line number Diff line number Diff line change 11require "minitest/autorun"
2- require " bitarray"
2+ require_relative "../lib/ bitarray"
33
44class TestBitArray < Minitest ::Test
55 def setup
You can’t perform that action at this time.
0 commit comments