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
13namespace immer {
14namespace detail {
15namespace rbts {
16
17using bits_t = std::uint32_t;
18using shift_t = std::uint32_t;
19using count_t = std::uint32_t;
20using size_t = std::size_t;
21
22template <bits_t B, typename T=count_t>
23constexpr T branches = T{1} << B;
24
25template <bits_t B, typename T=size_t>
26constexpr T mask = branches<B, T> - 1;
27
28template <bits_t B, bits_t BL>
29constexpr shift_t endshift = shift_t{BL} - shift_t{B};
30
31} // namespace rbts
32} // namespace detail
33} // namespace immer
34