Cube/src/tools.h
Jonathan Schleifer 3a7e871e0e Remove u{char,short,int}
FossilOrigin-Name: b5bfe2af86efc76d1ac600bf7cda4a1709aaa95ae2392ee9e3f98ce6d4b14bcf
2025-03-23 02:59:37 +00:00

49 lines
894 B
Objective-C

// generic useful stuff for any C++ program
#ifndef _TOOLS_H
#define _TOOLS_H
#ifdef __GNUC__
# define gamma __gamma
#endif
#include <math.h>
#ifdef __GNUC__
# undef gamma
#endif
#include <assert.h>
#include <limits.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#import <ObjFW/ObjFW.h>
#define max(a, b) (((a) > (b)) ? (a) : (b))
#define min(a, b) (((a) < (b)) ? (a) : (b))
#define rnd(max) (rand() % (max))
#define rndreset() (srand(1))
#define rndtime() \
{ \
for (int i = 0; i < (lastmillis & 0xF); i++) \
rnd(i + 1); \
}
#ifndef OF_WINDOWS
# define __cdecl
#endif
#define fast_f2nat(val) ((int)(val))
#ifdef __cplusplus
extern "C" {
#endif
extern void endianswap(void *, int, int);
#ifdef __cplusplus
}
#endif
#endif