|
Listing 3
Macros for rounding, with a type cast thrown in
|
#define UC_RND(i) ((UBYTE)((i)+0.5))
#define SC_RND(i) (((i)>=0) ? (BYTE)((i)+0.5) : (BYTE)((i)- 0.5))
#define US_RND(i) ((UWORD)((i)+0.5))
#define SS_RND(i) (((i)>=0) ? (WORD)((i)+0.5) : (WORD)((i)-0.5))
#define UL_RND(i) ((ULONG)((i)+0.5))
#define SL_RND(i) (((i)>=0) ? (LONG)((i)+0.5) :
(LONG)((i)-0.5))
|
|
Back
|
|
|
|
|
Ready to take that job and shove it?
|
|