Serenity Operating System
at portability 144 lines 4.5 kB view raw
1/* 2 * Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org> 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions are met: 7 * 8 * 1. Redistributions of source code must retain the above copyright notice, this 9 * list of conditions and the following disclaimer. 10 * 11 * 2. Redistributions in binary form must reproduce the above copyright notice, 12 * this list of conditions and the following disclaimer in the documentation 13 * and/or other materials provided with the distribution. 14 * 15 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 16 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 19 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 20 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 21 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 22 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 23 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 24 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 */ 26 27#pragma once 28 29#include <sys/cdefs.h> 30 31__BEGIN_DECLS 32 33typedef __UINT64_TYPE__ uint64_t; 34typedef __UINT32_TYPE__ uint32_t; 35typedef __UINT16_TYPE__ uint16_t; 36typedef __UINT8_TYPE__ uint8_t; 37 38typedef __INT64_TYPE__ int64_t; 39typedef __INT32_TYPE__ int32_t; 40typedef __INT16_TYPE__ int16_t; 41typedef __INT8_TYPE__ int8_t; 42 43typedef __UINT_FAST8_TYPE__ uint_fast8_t; 44typedef __UINT_FAST16_TYPE__ uint_fast16_t; 45typedef __UINT_FAST32_TYPE__ uint_fast32_t; 46typedef __UINT_FAST64_TYPE__ uint_fast64_t; 47 48typedef __INT_FAST8_TYPE__ int_fast8_t; 49typedef __INT_FAST16_TYPE__ int_fast16_t; 50typedef __INT_FAST32_TYPE__ int_fast32_t; 51typedef __INT_FAST64_TYPE__ int_fast64_t; 52 53typedef __UINT_LEAST8_TYPE__ uint_least8_t; 54typedef __UINT_LEAST16_TYPE__ uint_least16_t; 55typedef __UINT_LEAST32_TYPE__ uint_least32_t; 56typedef __UINT_LEAST64_TYPE__ uint_least64_t; 57 58typedef __INT_LEAST8_TYPE__ int_least8_t; 59typedef __INT_LEAST16_TYPE__ int_least16_t; 60typedef __INT_LEAST32_TYPE__ int_least32_t; 61typedef __INT_LEAST64_TYPE__ int_least64_t; 62 63#define __int8_t_defined 1 64#define __uint8_t_defined 1 65#define __int16_t_defined 1 66#define __uint16_t_defined 1 67#define __int32_t_defined 1 68#define __uint32_t_defined 1 69#define __int64_t_defined 1 70#define __uint64_t_defined 1 71 72typedef __UINTPTR_TYPE__ uintptr_t; 73typedef __INTPTR_TYPE__ intptr_t; 74 75typedef __UINTMAX_TYPE__ uintmax_t; 76#define UINTMAX_MAX __UINTMAX_MAX__ 77#define UINTMAX_MIN __UINTMAX_MIN__ 78 79typedef __INTMAX_TYPE__ intmax_t; 80#define INTMAX_MAX __INTMAX_MAX__ 81#define INTMAX_MIN (-INTMAX_MAX - 1) 82 83#define INT8_MIN (-128) 84#define INT16_MIN (-32767 - 1) 85#define INT32_MIN (-2147483647 - 1) 86#define INT64_MIN (-9223372036854775807LL - 1LL) 87#define INT8_MAX (127) 88#define INT16_MAX (32767) 89#define INT32_MAX (2147483647) 90#define INT64_MAX (9223372036854775807LL) 91#define UINT8_MAX (255) 92#define UINT16_MAX (65535) 93#define UINT32_MAX (4294967295U) 94#define UINT64_MAX (18446744073709551615ULL) 95 96#define INTPTR_MAX INT32_MAX 97#define INTPTR_MIN INT32_MIN 98#define UINTPTR_MAX UINT32_MAX 99 100#define INT_FAST8_MIN INT8_MIN 101#define INT_FAST16_MIN INT16_MIN 102#define INT_FAST32_MIN INT32_MIN 103#define INT_FAST64_MIN INT64_MIN 104 105#define INT_FAST8_MAX INT8_MAX 106#define INT_FAST16_MAX INT16_MAX 107#define INT_FAST32_MAX INT32_MAX 108#define INT_FAST64_MAX INT64_MAX 109 110#define UINT_FAST8_MAX UINT8_MAX 111#define UINT_FAST16_MAX UINT16_MAX 112#define UINT_FAST32_MAX UINT32_MAX 113#define UINT_FAST64_MAX UINT64_MAX 114 115#define INT_LEAST8_MIN INT8_MIN 116#define INT_LEAST16_MIN INT16_MIN 117#define INT_LEAST32_MIN INT32_MIN 118#define INT_LEAST64_MIN INT64_MIN 119 120#define INT_LEAST8_MAX INT8_MAX 121#define INT_LEAST16_MAX INT16_MAX 122#define INT_LEAST32_MAX INT32_MAX 123#define INT_LEAST64_MAX INT64_MAX 124 125#define UINT_LEAST8_MAX UINT8_MAX 126#define UINT_LEAST16_MAX UINT16_MAX 127#define UINT_LEAST32_MAX UINT32_MAX 128#define UINT_LEAST64_MAX UINT64_MAX 129 130#define INT8_C(x) x 131#define UINT8_C(x) x 132 133#define INT16_C(x) x 134#define UINT16_C(x) x 135 136#define INT32_C(x) x 137#define UINT32_C(x) x 138 139#define INT64_C(x) x##LL 140#define UINT64_C(x) x##ULL 141 142#define SIZE_MAX ((size_t)-1) 143 144__END_DECLS