home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Fred Fish Collection 1.5
/
ffcollection-1-5-1992-11.iso
/
ff_disks
/
300-399
/
ff314.lha
/
zc
/
zc.lzh
/
include
/
macros.h
< prev
next >
Wrap
C/C++ Source or Header
|
1988-11-09
|
649b
|
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