From 3906568908bec2a8f98e4b4086b95a281c624830 Mon Sep 17 00:00:00 2001 From: Stefan Kalkowski Date: Thu, 1 Jun 2017 11:31:15 +0200 Subject: [PATCH] util: make bit array and allocator copyable Ref #2091 --- repos/base/include/util/bit_allocator.h | 1 + repos/base/include/util/bit_array.h | 2 ++ 2 files changed, 3 insertions(+) diff --git a/repos/base/include/util/bit_allocator.h b/repos/base/include/util/bit_allocator.h index 20fc5be0e5..258a766721 100644 --- a/repos/base/include/util/bit_allocator.h +++ b/repos/base/include/util/bit_allocator.h @@ -55,6 +55,7 @@ class Genode::Bit_allocator Bit_allocator() : _next(0) { _reserve(BITS, BITS_ALIGNED - BITS); } + Bit_allocator(const Bit_allocator & o) : _next(0), _array(o._array) { } addr_t alloc(size_t const num_log2 = 0) { diff --git a/repos/base/include/util/bit_array.h b/repos/base/include/util/bit_array.h index e010c635c4..d5c4055315 100644 --- a/repos/base/include/util/bit_array.h +++ b/repos/base/include/util/bit_array.h @@ -149,6 +149,8 @@ class Genode::Bit_array : public Bit_array_base public: Bit_array() : Bit_array_base(BITS, _array, true) { } + Bit_array(const Bit_array & o) : Bit_array_base(BITS, _array, false) { + memcpy(&_array, &o._array, sizeof(_array)); } }; #endif /* _INCLUDE__UTIL__BIT_ARRAY_H_ */