Skip to content

Commit 20a17ad

Browse files
committed
Allow initial field to be set
Realized I also need a way to restore the field
1 parent e24928a commit 20a17ad

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/bitarray.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ class BitArray
55

66
ELEMENT_WIDTH = 32
77

8-
def initialize(size)
8+
def initialize(size, field = nil)
99
@size = size
10-
@field = Array.new(((size - 1) / ELEMENT_WIDTH) + 1, 0)
10+
@field = field || Array.new(((size - 1) / ELEMENT_WIDTH) + 1, 0)
1111
end
1212

1313
# Set a bit (1/0)

0 commit comments

Comments
 (0)