home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Dream 48
/
Amiga_Dream_48.iso
/
Atari
/
c
/
sozobon-v2
/
dlibs12.lha
/
H.ARC
/
MACROS.H
< prev
next >
Wrap
C/C++ Source or Header
|
1987-12-10
|
675b
|
27 lines
/*
* MACROS.H commonly useful macros
*/
#ifndef MACROS_H
#define MACROS_H
/* absolute value for any type of number */
#define abs(x) ((x)<0?(-(x)):(x))
/* maximum and minumum for any type of number */
#define max(x,y) (((x)>(y))?(x):(y))
#define min(x,y) (((x)<(y))?(x):(y))
/* swap any objects which can be XORed */
#define swap(a,b) ((a)=(a)^((b)=(b)^((a)=(a)^(b))))
/* lo and hi byte of a word */
#define lobyte(x) (((unsigned char *)&(x))[1])
#define hibyte(x) (((unsigned char *)&(x))[0])
/* lo and hi word of a long */
#define loword(x) (((unsigned int *)&(x))[1])
#define hiword(x) (((unsigned int *)&(x))[0])
#endif MACROS_H