L4Re Operating System Framework
Interface and Usage Documentation
Loading...
Searching...
No Matches
limits
1// vi:set ft=cpp: -*- Mode: C++ -*-
2/*
3 * Copyright (C) 2026 Kernkonzept GmbH.
4 * Author(s): Frank Mehnert <frank.mehnert@kernkonzept.com>
5 *
6 * License: see LICENSE.spdx (in this directory or the directories above)
7 */
8
9#pragma once
10#pragma GCC system_header
11
12#include <stddef.h>
13#include <limits.h>
14
15typedef struct l4_msgtag_t l4_msgtag_t;
16
17// unfortunately we cannot include <limits>
18namespace L4 { namespace Types {
19
20 template< typename T > struct numeric_limits;
21 template<> struct numeric_limits<bool>
22 {
23 static constexpr bool min() { return false; }
24 static constexpr bool max() { return true; }
25 };
26 template<> struct numeric_limits<char>
27 {
28 static constexpr char min() { return CHAR_MIN; }
29 static constexpr char max() { return CHAR_MAX; }
30 };
31 template<> struct numeric_limits<signed char>
32 {
33 static constexpr signed char min() { return SCHAR_MIN; }
34 static constexpr signed char max() { return SCHAR_MAX; }
35 };
36 template<> struct numeric_limits<unsigned char>
37 {
38 static constexpr unsigned char min() { return 0; }
39 static constexpr unsigned char max() { return UCHAR_MAX; }
40 };
41 template<> struct numeric_limits<signed short int>
42 {
43 static constexpr signed short int min() { return SHRT_MIN; }
44 static constexpr signed short int max() { return SHRT_MAX; }
45 };
46 template<> struct numeric_limits<unsigned short int>
47 {
48 static constexpr unsigned short int min() { return 0; }
49 static constexpr unsigned short int max() { return USHRT_MAX; }
50 };
51 template<> struct numeric_limits<signed int>
52 {
53 static constexpr signed int min() { return INT_MIN; }
54 static constexpr signed int max() { return INT_MAX; }
55 };
56 template<> struct numeric_limits<unsigned int>
57 {
58 static constexpr unsigned int min() { return 0U; }
59 static constexpr unsigned int max() { return UINT_MAX; }
60 };
61 template<> struct numeric_limits<signed long int>
62 {
63 static constexpr signed long min() { return LONG_MIN; }
64 static constexpr signed long max() { return LONG_MAX; }
65 };
66 template<> struct numeric_limits<unsigned long int>
67 {
68 static constexpr unsigned long int min() { return 0UL; }
69 static constexpr unsigned long int max() { return ULONG_MAX; }
70 };
71 template<> struct numeric_limits<signed long long int>
72 {
73 static constexpr signed long long min() { return LLONG_MIN; }
74 static constexpr signed long long max() { return LLONG_MAX; }
75 };
76 template<> struct numeric_limits<unsigned long long int>
77 {
78 static constexpr unsigned long long min() { return 0ULL; }
79 static constexpr unsigned long long max() { return ULLONG_MAX; }
80 };
81 template<> struct numeric_limits<l4_msgtag_t>
82 {
83 static constexpr long min() { return -max() - 1L; }
84 static constexpr long max() { return numeric_limits<long>::max() >> 16; }
85 };
86
87}} // namespace Types, namespace L4
88
L4 basic type helpers for C++.
Definition limits:18
L4 low-level kernel interface.
Message tag data structure.
Definition types.h:269