summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/macros.h
diff options
context:
space:
mode:
authorBrian Paul <brianp@vmware.com>2012-05-18 14:45:20 -0600
committerBrian Paul <brianp@vmware.com>2012-05-19 08:28:57 -0600
commitc9cb9cf0502f4ca179ed1b4dd763c94912843d38 (patch)
treef518f7d395fe4919d8db078c7613a8d0316107af /src/mesa/main/macros.h
parent699c1894eea6a42a747ebbc3974bf0abf3d1dd88 (diff)
downloadexternal_mesa3d-c9cb9cf0502f4ca179ed1b4dd763c94912843d38.zip
external_mesa3d-c9cb9cf0502f4ca179ed1b4dd763c94912843d38.tar.gz
external_mesa3d-c9cb9cf0502f4ca179ed1b4dd763c94912843d38.tar.bz2
mesa: use F_TO_I() instead of IROUND()
Use it where performance matters more and the exact method of float->int conversion/rounding isn't terribly important. There should no net change here since F_TO_I() is the new name of the old IROUND() function. Reviewed-by: José Fonseca <jfonseca@vmware.com>
Diffstat (limited to 'src/mesa/main/macros.h')
-rw-r--r--src/mesa/main/macros.h10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/mesa/main/macros.h b/src/mesa/main/macros.h
index dbe5b86..d1df2ce 100644
--- a/src/mesa/main/macros.h
+++ b/src/mesa/main/macros.h
@@ -129,12 +129,12 @@ extern GLfloat _mesa_ubyte_to_float_color_tab[256];
#define INT_TO_USHORT(i) ((i) < 0 ? 0 : ((GLushort) ((i) >> 15)))
#define UINT_TO_USHORT(i) ((i) < 0 ? 0 : ((GLushort) ((i) >> 16)))
#define UNCLAMPED_FLOAT_TO_USHORT(us, f) \
- us = ( (GLushort) IROUND( CLAMP((f), 0.0F, 1.0F) * 65535.0F) )
+ us = ( (GLushort) F_TO_I( CLAMP((f), 0.0F, 1.0F) * 65535.0F) )
#define CLAMPED_FLOAT_TO_USHORT(us, f) \
- us = ( (GLushort) IROUND( (f) * 65535.0F) )
+ us = ( (GLushort) F_TO_I( (f) * 65535.0F) )
#define UNCLAMPED_FLOAT_TO_SHORT(s, f) \
- s = ( (GLshort) IROUND( CLAMP((f), -1.0F, 1.0F) * 32767.0F) )
+ s = ( (GLshort) F_TO_I( CLAMP((f), -1.0F, 1.0F) * 32767.0F) )
/***
*** UNCLAMPED_FLOAT_TO_UBYTE: clamp float to [0,1] and map to ubyte in [0,255]
@@ -166,9 +166,9 @@ extern GLfloat _mesa_ubyte_to_float_color_tab[256];
} while (0)
#else
#define UNCLAMPED_FLOAT_TO_UBYTE(ub, f) \
- ub = ((GLubyte) IROUND(CLAMP((f), 0.0F, 1.0F) * 255.0F))
+ ub = ((GLubyte) F_TO_I(CLAMP((f), 0.0F, 1.0F) * 255.0F))
#define CLAMPED_FLOAT_TO_UBYTE(ub, f) \
- ub = ((GLubyte) IROUND((f) * 255.0F))
+ ub = ((GLubyte) F_TO_I((f) * 255.0F))
#endif
/*@}*/