1
0
mirror of https://gitlab.os-k.eu/os-k-team/os-k.git synced 2023-08-25 14:03:10 +02:00
os-k/include/base/bdefs.h

149 lines
3.9 KiB
C
Raw Normal View History

2019-01-21 15:00:04 +01:00
//----------------------------------------------------------------------------//
// GNU GPL OS/K //
// //
2019-02-16 23:36:33 +01:00
// Desc: Basic preprocessor definitions //
2019-01-21 15:00:04 +01:00
// //
2019-02-16 23:36:33 +01:00
// //
// 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/>. //
2019-01-21 15:00:04 +01:00
//----------------------------------------------------------------------------//
#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
2019-01-21 15:00:04 +01:00
#ifndef INITOK
#define INITOK ((unsigned int)0xCAFEBABE)
#endif
//------------------------------------------//
2019-03-18 17:25:44 +01:00
#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
//------------------------------------------//
2019-02-16 23:36:33 +01:00
#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
//------------------------------------------//
2019-01-21 15:00:04 +01:00
#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
2019-01-21 15:00:04 +01:00
#ifndef __bool_true_false_are_defined
#define __bool_true_false_are_defined
#ifndef __cplusplus
2019-01-21 15:00:04 +01:00
# define bool _Bool
# define true 1
# define false 0
#else
# define bool bool
# define true true
# define false false
#endif
2019-01-21 15:00:04 +01:00
#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