1 | // |
2 | // immer: immutable data structures for C++ |
3 | // Copyright (C) 2016, 2017, 2018 Juan Pedro Bolivar Puente |
4 | // |
5 | // This software is distributed under the Boost Software License, Version 1.0. |
6 | // See accompanying file LICENSE or copy at http://boost.org/LICENSE_1_0.txt |
7 | // |
8 | |
9 | #pragma once |
10 | |
11 | #include <cstdint> |
12 | |
13 | namespace immer { |
14 | namespace detail { |
15 | namespace rbts { |
16 | |
17 | using bits_t = std::uint32_t; |
18 | using shift_t = std::uint32_t; |
19 | using count_t = std::uint32_t; |
20 | using size_t = std::size_t; |
21 | |
22 | template <bits_t B, typename T=count_t> |
23 | constexpr T branches = T{1} << B; |
24 | |
25 | template <bits_t B, typename T=size_t> |
26 | constexpr T mask = branches<B, T> - 1; |
27 | |
28 | template <bits_t B, bits_t BL> |
29 | constexpr shift_t endshift = shift_t{BL} - shift_t{B}; |
30 | |
31 | } // namespace rbts |
32 | } // namespace detail |
33 | } // namespace immer |
34 | |