made the INT_MULT3 macro be more accurate.

* app/paint_funcs.c: made the INT_MULT3 macro be more accurate.
This commit is contained in:
jaycox 1999-03-12 06:04:09 +00:00
parent 7fd5b7c18e
commit 17b18717e7
3 changed files with 28 additions and 4 deletions

View file

@ -1,3 +1,7 @@
1999-03-11 Jay Cox <jaycox@earthlink.net>
* app/paint_funcs.c: made the INT_MULT3 macro be more accurate.
1999-03-12 Michael Natterer <mitschel@cs.tu-berlin.de>
This is mostly unit stuff and code cleanup

View file

@ -47,8 +47,18 @@
#define EPSILON 0.0001
#define INT_MULT(a,b,t) ((t) = (a) * (b) + 0x80, ((((t) >> 8) + (t)) >> 8))
#define INT_MULT3(a,b,c,t) ((t) = (a) * (b) * (c)+ 0x100, \
((((t) >> 16) + (t)) >> 16))
/* This version of INT_MULT3 is very fast, but suffers from some
slight roundoff errors. It returns the correct result 99.987%
percent of the time */
#define INT_MULT3(a,b,c,t) ((t) = (a) * (b) * (c)+ 0x7F5B, \
((((t) >> 7) + (t)) >> 16))
/*
This version of INT_MULT3 always gives the correct result, but runs at
approximatly one third the speed. */
/* #define INT_MULT3(a,b,c,t) (((a) * (b) * (c)+ 32512) / 65025.0)
*/
#define INT_BLEND(a,b,alpha,tmp) (INT_MULT((a)-(b), alpha, tmp) + (b))
typedef enum

View file

@ -47,8 +47,18 @@
#define EPSILON 0.0001
#define INT_MULT(a,b,t) ((t) = (a) * (b) + 0x80, ((((t) >> 8) + (t)) >> 8))
#define INT_MULT3(a,b,c,t) ((t) = (a) * (b) * (c)+ 0x100, \
((((t) >> 16) + (t)) >> 16))
/* This version of INT_MULT3 is very fast, but suffers from some
slight roundoff errors. It returns the correct result 99.987%
percent of the time */
#define INT_MULT3(a,b,c,t) ((t) = (a) * (b) * (c)+ 0x7F5B, \
((((t) >> 7) + (t)) >> 16))
/*
This version of INT_MULT3 always gives the correct result, but runs at
approximatly one third the speed. */
/* #define INT_MULT3(a,b,c,t) (((a) * (b) * (c)+ 32512) / 65025.0)
*/
#define INT_BLEND(a,b,alpha,tmp) (INT_MULT((a)-(b), alpha, tmp) + (b))
typedef enum