skip_list.cpp 450 B

123456789101112131415161718192021222324252627
  1. #include "skip_list.hpp"
  2. #include <cstring>
  3. #include <new>
  4. namespace xrcu
  5. {
  6. namespace detail
  7. {
  8. void* sl_alloc_node (unsigned int lvl, size_t size, uintptr_t **outpp)
  9. {
  10. void *p = ::operator new (size + lvl * sizeof (uintptr_t));
  11. *outpp = (uintptr_t *)((char *)p + size);
  12. memset (*outpp, 0, lvl * sizeof (uintptr_t));
  13. return (p);
  14. }
  15. void sl_dealloc_node (void *ptr)
  16. {
  17. ::operator delete (ptr);
  18. }
  19. } // namespace detail
  20. } // namespace xrcu