mirror of
https://gitlab.os-k.eu/os-k-team/os-k.git
synced 2023-08-25 14:03:10 +02:00
149 lines
3.9 KiB
C
149 lines
3.9 KiB
C
//----------------------------------------------------------------------------//
|
|
// GNU GPL OS/K //
|
|
// //
|
|
// Desc: Basic preprocessor definitions //
|
|
// //
|
|
// //
|
|
// Copyright © 2018-2019 The OS/K Team //
|
|
// //
|
|
// This file is part of OS/K. //
|
|
// //
|
|
// OS/K 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 //
|
|
// any later version. //
|
|
// //
|
|
// OS/K 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 OS/K. If not, see <https://www.gnu.org/licenses/>. //
|
|
//----------------------------------------------------------------------------//
|
|
|
|
#ifndef _KALBASE_BDEFS_H
|
|
#define _KALDEFS_BDEFS_H
|
|
|
|
//------------------------------------------//
|
|
|
|
#ifndef TRUE
|
|
#define TRUE 1
|
|
#endif
|
|
|
|
#ifndef FALSE
|
|
#define FALSE 0
|
|
#endif
|
|
|
|
#ifndef NULL
|
|
#define NULL 0L
|
|
#endif
|
|
|
|
#ifndef RAND_MAX
|
|
#define RAND_MAX (1 << 30)
|
|
#endif
|
|
|
|
#ifndef INITOK
|
|
#define INITOK ((unsigned int)0xCAFEBABE)
|
|
#endif
|
|
|
|
//------------------------------------------//
|
|
|
|
#ifndef _NO_UNITS
|
|
#define KB (1UL << 10)
|
|
#define MB (1UL << 20)
|
|
#define GB (1UL << 30)
|
|
#define TB (1UL << 40)
|
|
#endif
|
|
|
|
#ifndef _ALIGN_UP
|
|
#define _ALIGN_UP(x, s) (((x) + (s) - 1) & (~((s) - 1)))
|
|
#endif
|
|
|
|
//------------------------------------------//
|
|
|
|
#ifndef __BEGIN_DECLS
|
|
#ifdef __cpluplus
|
|
# define __EXTERN_C extern "C"
|
|
# define __BEGIN_DECLS extern "C" {
|
|
# define __END_DECLS }
|
|
#else
|
|
# define __EXTERN_C
|
|
# define __BEGIN_DECLS
|
|
# define __END_DECLS
|
|
#endif
|
|
#endif
|
|
|
|
//------------------------------------------//
|
|
|
|
#if defined(_NO_DEBUG) || defined(NDEBUG)
|
|
#ifndef NDEBUG
|
|
#define NDEBUG 1
|
|
#endif
|
|
#ifndef _NO_DEBUG
|
|
#define _NO_DEBUG 1
|
|
#endif
|
|
#endif
|
|
|
|
//------------------------------------------//
|
|
|
|
#ifndef __alignof_is_defined
|
|
#define __alignof_is_defined
|
|
#define alignof _Alignof
|
|
#endif
|
|
|
|
#ifndef __alignas_is_defined
|
|
#define __alignas_is_defined
|
|
#define alignas _Alignas
|
|
#endif
|
|
|
|
#ifndef TRUE
|
|
#define TRUE 1
|
|
#endif
|
|
|
|
#ifndef FALSE
|
|
#define FALSE 0
|
|
#endif
|
|
|
|
#ifndef __bool_true_false_are_defined
|
|
#define __bool_true_false_are_defined
|
|
#ifndef __cplusplus
|
|
# define bool _Bool
|
|
# define true 1
|
|
# define false 0
|
|
#else
|
|
# define bool bool
|
|
# define true true
|
|
# define false false
|
|
#endif
|
|
#endif
|
|
//------------------------------------------//
|
|
|
|
#ifndef _PACKED
|
|
#define _PACKED __attribute__((__packed__))
|
|
#endif
|
|
|
|
#ifndef noreturn
|
|
#define noreturn __attribute__((__noreturn__))
|
|
#endif
|
|
|
|
#ifndef likely
|
|
#define likely(x) (__builtin_expect((x), 1))
|
|
#endif
|
|
|
|
#ifndef unlikely
|
|
#define unlikely(x) (__builtin_expect((x), 0))
|
|
#endif
|
|
|
|
#ifndef _STR
|
|
#define _STR(x) #x
|
|
#endif
|
|
|
|
#ifndef _XSTR
|
|
#define _XSTR(x) _STR(x)
|
|
#endif
|
|
|
|
//------------------------------------------//
|
|
|
|
#endif
|