TeDDy 4.1.0
Decision diagram library.
Loading...
Searching...
No Matches
types.hpp
1#ifndef LIBTEDDY_DETAILS_TYPES_HPP
2#define LIBTEDDY_DETAILS_TYPES_HPP
3
4#include <cstddef>
5#include <cstdint>
6
7namespace teddy
8{
9using int32 = std::int32_t;
10using int64 = std::int64_t;
11using uint32 = std::uint32_t;
12using uint64 = std::uint64_t;
13
14inline constexpr int32 Undefined = ~(1 << (8 * sizeof(int32) - 1));
15inline constexpr int32 Nondetermined = Undefined - 1;
16
17[[nodiscard]] inline auto constexpr as_uindex(int32 const index)
18{
19 return static_cast<uint32>(index);
20}
21
22[[nodiscard]] inline auto constexpr as_uindex(int64 const index)
23{
24 return static_cast<std::size_t>(index);
25}
26
27[[nodiscard]] inline auto constexpr as_usize(int32 const size)
28{
29 return static_cast<uint32>(size);
30}
31
32[[nodiscard]] inline auto constexpr as_usize(int64 const size)
33{
34 return static_cast<std::size_t>(size);
35}
36
37[[nodiscard]] inline auto constexpr special_to_index(int32 const val) -> int32
38{
39 return -1 * val - 1;
40}
41
42[[nodiscard]] inline auto constexpr is_special(int32 const val) -> bool
43{
44 return val == Undefined;
45}
46} // namespace teddy
47
48#endif