21 #include <unordered_map> 38 static_assert(
sizeof(ignore) == 9,
"PackedSyncPtr wasn't packable");
44 sp.
init(
new std::pair<int, int>[2]);
63 auto newP =
new std::pair<int, int>();
82 base.
set((
T*)realloc(base.
get(), (base.
extra() + 1) *
sizeof(
T)));
101 typedef std::unordered_map<int64_t, VecT>
Map;
104 static Map
map(mapCap);
109 for (
auto& kv :
map) {
111 kv.second.push_back(
id);
118 map.insert(std::make_pair(
i,
VecT()));
120 std::vector<std::thread> thrs;
121 for (intptr_t
i = 0;
i <
nthrs;
i++) {
124 for (
auto&
t : thrs) {
128 for (
auto& kv :
map) {
130 std::set<intptr_t> idsFound;
131 for (
auto& elem : kv.second) {
141 int* unaligned =
reinterpret_cast<int*
>(0xf003);
144 uintptr_t* bytes =
reinterpret_cast<uintptr_t*
>(&p);
145 LOG(INFO) <<
"Bytes integer is: 0x" << std::hex << *bytes;
void setExtra(uint16_t extra)
#define EXPECT_EQ(val1, val2)
void push_back(const T &t)
std::unordered_map< int64_t, VecT > Map
void init(T *initialPtr=nullptr, uint16_t initialExtra=0)
void appThread(intptr_t id)
#define EXPECT_TRUE(condition)
TEST(PackedSyncPtr, Basic)
constexpr detail::First first