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
45
45
# Returns the total number of bits that are set
46
46
# (The technique used here is about 6 times faster than using each or inject direct on the bitfield)
47
47
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 }
49
49
end
50
50
end
Original file line number Diff line number Diff line change @@ -49,7 +49,7 @@ def each_byte
49
49
# Returns the total number of bits that are set
50
50
# (The technique used here is about 6 times faster than using each or inject direct on the bitfield)
51
51
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 }
53
53
end
54
54
55
55
def byte_position ( position )
Original file line number Diff line number Diff line change 1
1
require "minitest/autorun"
2
- require " bitarray"
2
+ require_relative "../lib/ bitarray"
3
3
4
4
class TestBitArray < Minitest ::Test
5
5
def setup
You can’t perform that action at this time.
0 commit comments