Allocator Builder
Policy Based C++ Template Allocator Library
 All Classes Functions Variables Enumerations Enumerator Groups Pages
heap_helpers.hpp
1 //
3 // Copyright 2014 Felix Petriconi
4 //
5 // License: http://boost.org/LICENSE_1_0.txt, Boost License 1.0
6 //
7 // Authors: http://petriconi.net, Felix Petriconi
8 //
10 #pragma once
11 
12 #include <stddef.h>
13 
14 namespace alb {
15  inline namespace v_100 {
16  namespace helpers {
17 
18  template <bool Used> uint64_t set_used(uint64_t const &currentRegister, uint64_t const &mask) noexcept;
19 
20  template <>
21  inline uint64_t set_used<false>(uint64_t const &currentRegister, uint64_t const &mask) noexcept
22  {
23  return currentRegister & (mask ^ uint64_t(-1));
24  }
25  template <> inline uint64_t set_used<true>(uint64_t const &currentRegister, uint64_t const &mask) noexcept
26  {
27  return currentRegister | mask;
28  }
29  }
30  }
31  using namespace v_100;
32 }