The manual
ginnOS
The reference: libc, the libraries and the kernel
Loading...
Searching...
No Matches
stdint.h
Go to the documentation of this file.
1#pragma once
2
3/**
4 * fixed-width integer types.
5 */
6// fixed-width types, pinned to the same C types on every target we build
7// for (i686 ILP32 and x86_64 LP64), so one printf format fits each:
8// %u/%x for uint32_t, %llu/%llx for uint64_t. pointer-width types below
9// (uintptr_t, size_t) are unsigned long on both: %lx, %zu.
10typedef signed char int8_t;
11typedef unsigned char uint8_t;
12typedef short int16_t;
13typedef unsigned short uint16_t;
14typedef int int32_t;
15typedef unsigned int uint32_t;
16typedef long long int64_t;
17typedef unsigned long long uint64_t;
18
19_Static_assert(sizeof(int32_t) == 4 && sizeof(uint64_t) == 8, "fixed-width types");
20
21// integers wide enough to hold a pointer: the only way pointers and integers
22// should be converted. the compiler names the right type for each target.
23typedef __INTPTR_TYPE__ intptr_t;
24typedef __UINTPTR_TYPE__ uintptr_t;
25
26#define UINTPTR_MAX __UINTPTR_MAX__
27#define UINT16_MAX 0xFFFF
28#define UINT32_MAX 0xFFFFFFFFu
29#define UINT64_MAX 0xFFFFFFFFFFFFFFFFull
30#define INT32_MAX 0x7FFFFFFF
31#define INT64_MAX 0x7FFFFFFFFFFFFFFFll
32
33typedef uint8_t bool;
34
35#define false 0
36#define true 1
37
38#include "common/stddef.h"
unsigned int uint32_t
Definition fb.h:17
unsigned char uint8_t
Definition fb.h:18
__INTPTR_TYPE__ intptr_t
Definition stdint.h:18
__UINT64_TYPE__ uint64_t
Definition stdint.h:17
unsigned short uint16_t
Definition stdint.h:13
int int32_t
Definition stdint.h:14
__UINTPTR_TYPE__ uintptr_t
Definition stdint.h:19
short int16_t
Definition stdint.h:12
__INT64_TYPE__ int64_t
Definition stdint.h:16
signed char int8_t
fixed-width integer types.
Definition stdint.h:10
#define bool
Definition stdbool.h:8