1
1
Fork 0
mirror of https://github.com/oxen-io/lokinet synced 2023-12-14 06:53:00 +01:00

fix osx compile

This commit is contained in:
Jeff 2019-05-10 12:18:26 -04:00
parent faacc86eb5
commit bae926d3d6

View file

@ -1,7 +1,5 @@
#ifndef LLARP_UTIL_ALLOC_HPP #ifndef LLARP_UTIL_ALLOC_HPP
#define LLARP_UTIL_ALLOC_HPP #define LLARP_UTIL_ALLOC_HPP
#include <memory>
#include <experimental/memory_resource>
#include <bitset> #include <bitset>
#include <array> #include <array>
@ -28,9 +26,9 @@ namespace llarp
Ptr_t Ptr_t
NewPtr() NewPtr()
{ {
void *ptr = mem->allocate(); Ptr_t ptr = mem->allocate();
::new(ptr) Value_t; ::new(ptr) Value_t;
return static_cast<Ptr_t>(ptr); return ptr;
} }
void void
@ -81,7 +79,7 @@ namespace llarp
_allocated.reset(_idx); _allocated.reset(_idx);
} }
[[nodiscard]] void * [[nodiscard]] Ptr_t
allocate() allocate()
{ {
const std::size_t _started = _pos; const std::size_t _started = _pos;
@ -95,7 +93,7 @@ namespace llarp
} }
} }
_allocated.set(_pos); _allocated.set(_pos);
return (Value_t *)&_buffer[_pos * sizeof(Value_t)]; return (Ptr_t)&_buffer[_pos * sizeof(Value_t)];
} }
}; };
@ -105,4 +103,4 @@ namespace llarp
} // namespace util } // namespace util
} // namespace llarp } // namespace llarp
#endif #endif