File tree Expand file tree Collapse file tree 2 files changed +11
-2
lines changed Expand file tree Collapse file tree 2 files changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -137,7 +137,7 @@ function union!(s::BitSet, r::AbstractUnitRange{<:Integer})
137
137
138
138
# grow s.bits as necessary
139
139
if diffb >= len
140
- _growend ! (s. bits, diffb - len + 1 )
140
+ _growend0 ! (s. bits, diffb - len + 1 )
141
141
# we set only some values to CHK0, those which will not be
142
142
# fully overwritten (i.e. only or'ed with `|`)
143
143
s. bits[end ] = CHK0 # end == diffb + 1
@@ -146,7 +146,7 @@ function union!(s::BitSet, r::AbstractUnitRange{<:Integer})
146
146
end
147
147
end
148
148
if diffa < 0
149
- _growbeg ! (s. bits, - diffa)
149
+ _growbeg0 ! (s. bits, - diffa)
150
150
s. bits[1 ] = CHK0
151
151
if diffb < 0
152
152
s. bits[diffb - diffa + 1 ] = CHK0
Original file line number Diff line number Diff line change 351
351
# union! with an empty range doesn't modify the BitSet
352
352
@test union! (x, b: a) == y
353
353
end
354
+
355
+ @testset " union!(::BitSet, ::AbstractUnitRange) when two ranges do not overlap" begin
356
+ # see #45574
357
+ a, b = minmax (rand (- 1000 : 1000 , 2 )... )
358
+ c, d = minmax (rand (2000 : 3000 , 2 )... )
359
+ @test length (union! (BitSet (a: b), c: d)) == length (a: b) + length (c: d)
360
+ c, d = minmax (rand (- 3000 : - 2000 , 2 )... )
361
+ @test length (union! (BitSet (a: b), c: d)) == length (a: b) + length (c: d)
362
+ end
You can’t perform that action at this time.
0 commit comments