Main Page | Data Structures | File List | Data Fields | Globals

defs.h File Reference

basic definitions and utilities More...

Go to the source code of this file.

Defines

#define map_block(x, y)   ((((y) & ~(7)) << 5) + ((x) & ~(7)))
 maps a block in the screen 2 model
#define map_pixel(x, y)   (map_block(x,y) + ((y) & 7))
 maps a pixel coordinate to a vram address
#define map_subpixel(x)   (128 >> ((x) & 7))
 maps the subpixel (bit) inside the vram byte
#define i2f(v)   ((v) << 6)
 integer to fixed-point
#define f2i(v)   ((v) >> 6)
 fixed-point to integer
#define mulfx(x, y)   ((LONG(y) * LONG(x)) >> 6)
 fixed-point multiplication
#define divfx(x, y)   ((LONG(x) << 6) / LONG(y))
 fixed-point division
#define sqrfx(x)   ((LONG(x) * LONG(x)) >> 6)
 fixed-point square
#define sqrtfx(x)   (LONG(sqrt(x)) << 3)
 fixed-point square root
#define wgavgfx(x, y, w)   (mulfx(i2f(1) - w, x) + mulfx(w, y))
 weighted average (w=0.0 -> x, w=0.5->average, w=1.0 ->y)
#define new(x)   ((x*)malloc(sizeof(x)))
 allocates space for 1 element of type x
#define newa(x, c)   ((x*)malloc(sizeof(x) * c))
 allocates space for c elements of type x


Detailed Description

basic definitions and utilities

Definition in file defs.h.


Generated on Thu Mar 3 19:55:02 2005 for GFX lib by  doxygen 1.4.1