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
15// unfortunately we cannot include <limits>
16namespace L4 { namespace Types {
17
18 template< typename T > struct numeric_limits;
19 template<> struct numeric_limits<bool>
20 {
21 static constexpr bool min() { return false; }
22 static constexpr bool max() { return true; }
23 };
24 template<> struct numeric_limits<char>
25 {
26 static constexpr signed char min() { return SCHAR_MIN; }
27 static constexpr signed char max() { return SCHAR_MAX; }
28 };
29 template<> struct numeric_limits<unsigned char>
30 {
31 static constexpr unsigned char min() { return 0; }
32 static constexpr unsigned char max() { return UCHAR_MAX; }
33 };
34 template<> struct numeric_limits<signed short int>
35 {
36 static constexpr signed short int min() { return SHRT_MIN; }
37 static constexpr signed short int max() { return SHRT_MAX; }
38 };
39 template<> struct numeric_limits<unsigned short int>
40 {
41 static constexpr unsigned short int min() { return 0; }
42 static constexpr unsigned short int max() { return USHRT_MAX; }
43 };
44 template<> struct numeric_limits<signed int>
45 {
46 static constexpr signed int min() { return INT_MIN; }
47 static constexpr signed int max() { return INT_MAX; }
48 };
49 template<> struct numeric_limits<unsigned int>
50 {
51 static constexpr unsigned int min() { return 0U; }
52 static constexpr unsigned int max() { return UINT_MAX; }
53 };
54 template<> struct numeric_limits<signed long int>
55 {
56 static constexpr signed long min() { return LONG_MIN; }
57 static constexpr signed long max() { return LONG_MAX; }
58 };
59 template<> struct numeric_limits<unsigned long int>
60 {
61 static constexpr unsigned long int min() { return 0UL; }
62 static constexpr unsigned long int max() { return ULONG_MAX; }
63 };
64 template<> struct numeric_limits<signed long long int>
65 {
66 static constexpr signed long long min() { return LLONG_MIN; }
67 static constexpr signed long long max() { return LLONG_MAX; }
68 };
69 template<> struct numeric_limits<unsigned long long int>
70 {
71 static constexpr unsigned long long min() { return 0ULL; }
72 static constexpr unsigned long long max() { return ULLONG_MAX; }
73 };
74 template<> struct numeric_limits<l4_msgtag_t>
75 {
76 static constexpr long min() { return -max() - 1L; }
77 static constexpr long max() { return numeric_limits<long>::max() >> 16; }
78 };
79
80}} // namespace Types, namespace L4
81
L4 basic type helpers for C++.
Definition limits:16
L4 low-level kernel interface.
Message tag data structure.
Definition types.h:266