mirror of
https://github.com/Fennix-Project/Drivers.git
synced 2025-05-25 22:14:31 +00:00
112 lines
3.0 KiB
C
112 lines
3.0 KiB
C
/*
|
|
This file is part of Fennix Drivers.
|
|
|
|
Fennix Drivers is free software: you can redistribute it and/or
|
|
modify it under the terms of the GNU General Public License as
|
|
published by the Free Software Foundation, either version 3 of
|
|
the License, or (at your option) any later version.
|
|
|
|
Fennix Drivers is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
GNU General Public License for more details.
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
along with Fennix Drivers. If not, see <https://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
#ifndef __FENNIX_API_TYPES_H__
|
|
#define __FENNIX_API_TYPES_H__
|
|
|
|
typedef __INT8_TYPE__ int8_t;
|
|
typedef __INT16_TYPE__ int16_t;
|
|
typedef __INT32_TYPE__ int32_t;
|
|
typedef __INT64_TYPE__ int64_t;
|
|
typedef __UINT8_TYPE__ uint8_t;
|
|
typedef __UINT16_TYPE__ uint16_t;
|
|
typedef __UINT32_TYPE__ uint32_t;
|
|
typedef __UINT64_TYPE__ uint64_t;
|
|
|
|
typedef __INT_LEAST8_TYPE__ int_least8_t;
|
|
typedef __INT_LEAST16_TYPE__ int_least16_t;
|
|
typedef __INT_LEAST32_TYPE__ int_least32_t;
|
|
typedef __INT_LEAST64_TYPE__ int_least64_t;
|
|
typedef __UINT_LEAST8_TYPE__ uint_least8_t;
|
|
typedef __UINT_LEAST16_TYPE__ uint_least16_t;
|
|
typedef __UINT_LEAST32_TYPE__ uint_least32_t;
|
|
typedef __UINT_LEAST64_TYPE__ uint_least64_t;
|
|
|
|
typedef __INT_FAST8_TYPE__ int_fast8_t;
|
|
typedef __INT_FAST16_TYPE__ int_fast16_t;
|
|
typedef __INT_FAST32_TYPE__ int_fast32_t;
|
|
typedef __INT_FAST64_TYPE__ int_fast64_t;
|
|
typedef __UINT_FAST8_TYPE__ uint_fast8_t;
|
|
typedef __UINT_FAST16_TYPE__ uint_fast16_t;
|
|
typedef __UINT_FAST32_TYPE__ uint_fast32_t;
|
|
typedef __UINT_FAST64_TYPE__ uint_fast64_t;
|
|
|
|
typedef __INTPTR_TYPE__ intptr_t;
|
|
typedef __UINTPTR_TYPE__ uintptr_t;
|
|
|
|
typedef __INTMAX_TYPE__ intmax_t;
|
|
typedef __UINTMAX_TYPE__ uintmax_t;
|
|
|
|
typedef __PTRDIFF_TYPE__ ptrdiff_t;
|
|
typedef __SIZE_TYPE__ size_t;
|
|
|
|
typedef __SIZE_TYPE__ dev_t;
|
|
typedef __SIZE_TYPE__ off_t;
|
|
typedef __INT32_TYPE__ mode_t;
|
|
typedef int pid_t;
|
|
|
|
#define UNUSED(x) (void)(x)
|
|
|
|
#ifdef __cplusplus
|
|
#define EXTERNC extern "C"
|
|
#define NULL 0
|
|
#else // __cplusplus
|
|
#define NULL ((void *)0)
|
|
#define bool _Bool
|
|
#define EXTERNC
|
|
#endif // __cplusplus
|
|
|
|
#define true 1
|
|
#define false 0
|
|
|
|
#define likely(x) __builtin_expect(!!(x), 1)
|
|
#define unlikely(x) __builtin_expect(!!(x), 0)
|
|
|
|
#define MAX(a, b) \
|
|
({ \
|
|
__typeof__(a) _a = (a); \
|
|
__typeof__(b) _b = (b); \
|
|
_a > _b ? _a : _b; \
|
|
})
|
|
|
|
#define MIN(a, b) \
|
|
({ \
|
|
__typeof__(a) _a = (a); \
|
|
__typeof__(b) _b = (b); \
|
|
_a < _b ? _a : _b; \
|
|
})
|
|
|
|
#ifndef __va_list__
|
|
typedef __builtin_va_list va_list;
|
|
#endif
|
|
|
|
#define asm __asm__
|
|
#define asmv __asm__ volatile
|
|
|
|
#if __STDC_VERSION__ >= 201112L && !defined(__cplusplus)
|
|
#define static_assert _Static_assert
|
|
#endif
|
|
|
|
#define va_start(v, l) __builtin_va_start(v, l)
|
|
#define va_end(v) __builtin_va_end(v)
|
|
#define va_arg(v, l) __builtin_va_arg(v, l)
|
|
|
|
#define TO_PAGES(d) (((d) + PAGE_SIZE - 1) / PAGE_SIZE)
|
|
#define FROM_PAGES(d) ((d) * PAGE_SIZE)
|
|
|
|
#endif // !__FENNIX_API_TYPES_H__
|