xo-arena: DArenaHashMap move impl to xo::map namespace
This commit is contained in:
parent
fcc29411c8
commit
29cf7d4f79
6 changed files with 18 additions and 16 deletions
|
|
@ -16,7 +16,7 @@
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
|
||||||
namespace xo {
|
namespace xo {
|
||||||
namespace mm {
|
namespace map {
|
||||||
#ifdef NOT_YET
|
#ifdef NOT_YET
|
||||||
enum class insert_error : int32_t {
|
enum class insert_error : int32_t {
|
||||||
/** sentinel **/
|
/** sentinel **/
|
||||||
|
|
@ -654,7 +654,7 @@ namespace xo {
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
} /*namespace map*/
|
||||||
} /*namespace xo*/
|
} /*namespace xo*/
|
||||||
|
|
||||||
/* end DArenaHashMap.hpp */
|
/* end DArenaHashMap.hpp */
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
|
||||||
namespace xo {
|
namespace xo {
|
||||||
namespace mm {
|
namespace map {
|
||||||
namespace detail {
|
namespace detail {
|
||||||
/** @brief 16x 8-bit control bytes.
|
/** @brief 16x 8-bit control bytes.
|
||||||
*
|
*
|
||||||
|
|
@ -77,7 +77,7 @@ namespace xo {
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
} /*namespace mm*/
|
} /*namespace map*/
|
||||||
} /*namespace xo*/
|
} /*namespace xo*/
|
||||||
|
|
||||||
/* end ControlGroup.hpp */
|
/* end ControlGroup.hpp */
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@
|
||||||
#include "hashmap/DArenaHashMapUtil.hpp"
|
#include "hashmap/DArenaHashMapUtil.hpp"
|
||||||
|
|
||||||
namespace xo {
|
namespace xo {
|
||||||
namespace mm {
|
namespace map {
|
||||||
namespace detail {
|
namespace detail {
|
||||||
|
|
||||||
template <typename Key,
|
template <typename Key,
|
||||||
|
|
@ -76,7 +76,7 @@ namespace xo {
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
} /*namespace mm*/
|
} /*namespace map*/
|
||||||
} /*namespace xo*/
|
} /*namespace xo*/
|
||||||
|
|
||||||
/* end DArenaHashMapIterator.hpp */
|
/* end DArenaHashMapIterator.hpp */
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
|
||||||
namespace xo {
|
namespace xo {
|
||||||
namespace mm {
|
namespace map {
|
||||||
/** @class DArenaHashMapUtil
|
/** @class DArenaHashMapUtil
|
||||||
*
|
*
|
||||||
* @pre
|
* @pre
|
||||||
|
|
@ -103,7 +103,7 @@ namespace xo {
|
||||||
return std::make_pair(ngx, ng);;
|
return std::make_pair(ngx, ng);;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
} /*namespace mm*/
|
} /*namespace map*/
|
||||||
} /*namespace xo*/
|
} /*namespace xo*/
|
||||||
|
|
||||||
/* end DArenaHashMapUtil.hpp */
|
/* end DArenaHashMapUtil.hpp */
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@
|
||||||
#include "hashmap/ControlGroup.hpp"
|
#include "hashmap/ControlGroup.hpp"
|
||||||
|
|
||||||
namespace xo {
|
namespace xo {
|
||||||
namespace mm {
|
namespace map {
|
||||||
namespace detail {
|
namespace detail {
|
||||||
template <typename Key,
|
template <typename Key,
|
||||||
typename Value>
|
typename Value>
|
||||||
|
|
@ -17,6 +17,8 @@ namespace xo {
|
||||||
public:
|
public:
|
||||||
using value_type = std::pair<const Key, Value>;
|
using value_type = std::pair<const Key, Value>;
|
||||||
using group_type = detail::ControlGroup;
|
using group_type = detail::ControlGroup;
|
||||||
|
using control_vector_type = xo::mm::DArenaVector<uint8_t>;
|
||||||
|
using slot_vector_type = xo::mm::DArenaVector<value_type>;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/** group_exp2: number of groups {x, 2^x} **/
|
/** group_exp2: number of groups {x, 2^x} **/
|
||||||
|
|
@ -26,8 +28,8 @@ namespace xo {
|
||||||
n_group_exponent_{group_exp2.first},
|
n_group_exponent_{group_exp2.first},
|
||||||
n_group_{group_exp2.second},
|
n_group_{group_exp2.second},
|
||||||
n_slot_{group_exp2.second * c_group_size},
|
n_slot_{group_exp2.second * c_group_size},
|
||||||
control_{DArenaVector<uint8_t>::map(ArenaConfig{.size_ = control_size(n_slot_)})},
|
control_{control_vector_type::map(xo::mm::ArenaConfig{.size_ = control_size(n_slot_)})},
|
||||||
slots_{DArenaVector<value_type>::map(ArenaConfig{.size_ = n_slot_ * sizeof(value_type)})}
|
slots_{slot_vector_type::map(xo::mm::ArenaConfig{.size_ = n_slot_ * sizeof(value_type)})}
|
||||||
{
|
{
|
||||||
/* here: arenas have allocated address range, but no committed memory yet */
|
/* here: arenas have allocated address range, but no committed memory yet */
|
||||||
|
|
||||||
|
|
@ -121,12 +123,12 @@ namespace xo {
|
||||||
/** control_[] partitioned into groups of
|
/** control_[] partitioned into groups of
|
||||||
* c_group_size (16) consecutive elements
|
* c_group_size (16) consecutive elements
|
||||||
**/
|
**/
|
||||||
DArenaVector<uint8_t> control_;
|
control_vector_type control_;
|
||||||
/** slots_[] holds {key,value} pairs **/
|
/** slots_[] holds {key,value} pairs **/
|
||||||
DArenaVector<value_type> slots_;
|
slot_vector_type slots_;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
} /*namespace mm*/
|
} /*namespace map*/
|
||||||
} /*namespace xo*/
|
} /*namespace xo*/
|
||||||
|
|
||||||
/* end HashMapStore.hpp */
|
/* end HashMapStore.hpp */
|
||||||
|
|
|
||||||
|
|
@ -11,8 +11,8 @@
|
||||||
#include <catch2/catch.hpp>
|
#include <catch2/catch.hpp>
|
||||||
|
|
||||||
namespace xo {
|
namespace xo {
|
||||||
using xo::mm::DArenaHashMapUtil;
|
using xo::map::DArenaHashMapUtil;
|
||||||
using xo::mm::DArenaHashMap;
|
using xo::map::DArenaHashMap;
|
||||||
using xo::rng::random_seed;
|
using xo::rng::random_seed;
|
||||||
using xo::rng::xoshiro256ss;
|
using xo::rng::xoshiro256ss;
|
||||||
using utest::UtestTools;
|
using utest::UtestTools;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue