Comms CCF
This is a simple communication layer based on COBS, CBOR and FNV-1A
Loading...
Searching...
No Matches
types.hpp
Go to the documentation of this file.
1
11#pragma once
12
13#include <stddef.h>
14#include <stdint.h>
15
16#include <bit>
17
18template<size_t N>
19struct Uint{};
20template<> struct Uint<8> { using Type = uint8_t; };;
21template<> struct Uint<16> { using Type = uint16_t; };;
22template<> struct Uint<32> { using Type = uint32_t; };;
23template<> struct Uint<64> { using Type = uint64_t; };;
24template<size_t N> using UintT = Uint<N>::Type;
25
26template<size_t I>
28{
29 static constexpr unsigned _bits = std::bit_width(I);
30 static constexpr unsigned _bytes = (_bits + 7) / 8;
31 static constexpr unsigned N = std::bit_ceil(_bytes);
32 using Type = Uint<N>;
33};
34template<size_t I> using SmallestTypeT = SmallestType<I>::Type;
Definition types.hpp:28
Definition types.hpp:19