mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 20:11:17 +00:00
Fix growable bitset (#1032)
This commit is contained in:
committed by
GitHub
parent
dad21bfc6f
commit
a1bce81ed0
@@ -106,10 +106,15 @@ fn void GrowableBitSet.set(&self, usz i)
|
||||
{
|
||||
usz q = i / BITS;
|
||||
usz r = i % BITS;
|
||||
if (q >= self.data.len())
|
||||
usz current_len = self.data.len();
|
||||
if (q >= current_len)
|
||||
{
|
||||
usz n = q + 1;
|
||||
self.data.reserve(n);
|
||||
if (n - 1 >= current_len)
|
||||
{
|
||||
self.data.entries[current_len .. (n - 1)] = 0;
|
||||
}
|
||||
self.data.size = n;
|
||||
}
|
||||
self.data.set(q, self.data[q] | (1 << r));
|
||||
|
||||
@@ -47,7 +47,6 @@ fn void! set_get()
|
||||
}
|
||||
|
||||
def GrowableBitSet = GrowableBitSet(<char>);
|
||||
|
||||
fn void! growable_set_get()
|
||||
{
|
||||
GrowableBitSet bs;
|
||||
|
||||
Reference in New Issue
Block a user