mirror of
https://github.com/genodelabs/genode.git
synced 2025-06-15 13:48:17 +00:00
committed by
Norman Feske
parent
24941ffaeb
commit
f7a7421091
@ -92,14 +92,14 @@ namespace Genode {
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
Bit_array_base(unsigned bits, addr_t *addr)
|
Bit_array_base(unsigned bits, addr_t *addr, bool clear)
|
||||||
: _bit_cnt(bits),
|
: _bit_cnt(bits),
|
||||||
_word_cnt(_bit_cnt / _BITS_PER_WORD),
|
_word_cnt(_bit_cnt / _BITS_PER_WORD),
|
||||||
_words(addr)
|
_words(addr)
|
||||||
{
|
{
|
||||||
if (!bits || bits % _BITS_PER_WORD) throw Invalid_bit_count();
|
if (!bits || bits % _BITS_PER_WORD) throw Invalid_bit_count();
|
||||||
|
|
||||||
memset(_words, 0, sizeof(addr_t)*_word_cnt);
|
if (clear) memset(_words, 0, sizeof(addr_t)*_word_cnt);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -144,7 +144,7 @@ namespace Genode {
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
Bit_array() : Bit_array_base(BITS, _array) { }
|
Bit_array() : Bit_array_base(BITS, _array, true) { }
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -76,7 +76,8 @@ class Genode::Packet_allocator : public Genode::Range_allocator
|
|||||||
_base = base;
|
_base = base;
|
||||||
_bits = _md_alloc->alloc(_block_cnt(size)/8);
|
_bits = _md_alloc->alloc(_block_cnt(size)/8);
|
||||||
_array = new (_md_alloc) Bit_array_base(_block_cnt(size),
|
_array = new (_md_alloc) Bit_array_base(_block_cnt(size),
|
||||||
(addr_t*)_bits);
|
(addr_t*)_bits,
|
||||||
|
true);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user