PS2SDK
PS2 Homebrew Libraries
Loading...
Searching...
No Matches
standard.h
1/*
2------------------------------------------------------------------------------
3Standard definitions and types, Bob Jenkins
4------------------------------------------------------------------------------
5*/
6#ifndef STANDARD
7# define STANDARD
8# ifndef STDIO
9# include <stdio.h>
10# define STDIO
11# endif
12# ifndef STDDEF
13# include <stddef.h>
14# define STDDEF
15# endif
16#define UB8MAXVAL 0xffffffffffffffffLL
17#define UB8BITS 64
18#define SB8MAXVAL 0x7fffffffffffffffLL
19#define UB4MAXVAL 0xffffffff
20#define UB4BITS 32
21#define SB4MAXVAL 0x7fffffff
22#define UB2MAXVAL 0xffff
23#define UB2BITS 16
24#define SB2MAXVAL 0x7fff
25#define UB1MAXVAL 0xff
26#define UB1BITS 8
27#define SB1MAXVAL 0x7f
28#ifdef _EE
29#include <tamtypes.h>
30typedef u64 ub8;
31typedef s64 sb8;
32typedef u32 ub4;
33typedef s32 sb4;
34typedef u16 ub2;
35typedef s16 sb2;
36typedef u8 ub1;
37typedef s8 sb1;
38#else
39typedef unsigned long long ub8;
40typedef signed long long sb8;
41typedef unsigned long int ub4; /* unsigned 4-byte quantities */
42typedef signed long int sb4;
43typedef unsigned short int ub2;
44typedef signed short int sb2;
45typedef unsigned char ub1;
46typedef signed char sb1; /* signed 1-byte quantities */
47#endif
48typedef int word; /* fastest type available */
49
50#define bis(target,mask) ((target) |= (mask))
51#define bic(target,mask) ((target) &= ~(mask))
52#define bit(target,mask) ((target) & (mask))
53#ifndef min
54# define min(a,b) (((a)<(b)) ? (a) : (b))
55#endif /* min */
56#ifndef max
57# define max(a,b) (((a)<(b)) ? (b) : (a))
58#endif /* max */
59#ifndef align
60# define align(a) (((ub4)a+(sizeof(void *)-1))&(~(sizeof(void *)-1)))
61#endif /* align */
62#ifndef abs
63# define abs(a) (((a)>0) ? (a) : -(a))
64#endif
65#define TRUE 1
66#define FALSE 0
67#define SUCCESS 0 /* 1 on VAX */
68
69#endif /* STANDARD */