raze-gles/source/core/utility/basics.h
2020-04-12 08:30:37 +02:00

47 lines
1 KiB
C

#ifndef __BASICS_H
#define __BASICS_H
#include <stddef.h>
#include <stdint.h>
//
// fixed point, 32bit as 16.16.
//
#define FRACBITS 16
#define FRACUNIT (1<<FRACBITS)
typedef int32_t fixed_t;
#define FIXED_MAX (signed)(0x7fffffff)
#define FIXED_MIN (signed)(0x80000000)
// the last remnants of tables.h
#define ANGLE_90 (0x40000000)
#define ANGLE_180 (0x80000000)
#define ANGLE_270 (0xc0000000)
#define ANGLE_MAX (0xffffffff)
typedef uint32_t angle_t;
#ifdef __GNUC__
#define GCCPRINTF(stri,firstargi) __attribute__((format(printf,stri,firstargi)))
#define GCCFORMAT(stri) __attribute__((format(printf,stri,0)))
#define GCCNOWARN __attribute__((unused))
#else
#define GCCPRINTF(a,b)
#define GCCFORMAT(a)
#define GCCNOWARN
#endif
#ifndef MAKE_ID
#ifndef __BIG_ENDIAN__
#define MAKE_ID(a,b,c,d) ((uint32_t)((a)|((b)<<8)|((c)<<16)|((d)<<24)))
#else
#define MAKE_ID(a,b,c,d) ((uint32_t)((d)|((c)<<8)|((b)<<16)|((a)<<24)))
#endif
#endif
using INTBOOL = int;
using BITFIELD = uint32_t;
#endif