summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/rastpos.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/main/rastpos.c')
-rw-r--r--src/mesa/main/rastpos.c21
1 files changed, 10 insertions, 11 deletions
diff --git a/src/mesa/main/rastpos.c b/src/mesa/main/rastpos.c
index 8f971f5b8d4..4fddad16f1b 100644
--- a/src/mesa/main/rastpos.c
+++ b/src/mesa/main/rastpos.c
@@ -91,17 +91,16 @@ viewclip_point_z( const GLfloat v[] )
static GLuint
userclip_point( struct gl_context *ctx, const GLfloat v[] )
{
- GLuint p;
-
- for (p = 0; p < ctx->Const.MaxClipPlanes; p++) {
- if (ctx->Transform.ClipPlanesEnabled & (1 << p)) {
- GLfloat dot = v[0] * ctx->Transform._ClipUserPlane[p][0]
- + v[1] * ctx->Transform._ClipUserPlane[p][1]
- + v[2] * ctx->Transform._ClipUserPlane[p][2]
- + v[3] * ctx->Transform._ClipUserPlane[p][3];
- if (dot < 0.0F) {
- return 0;
- }
+ GLbitfield mask = ctx->Transform.ClipPlanesEnabled;
+ while (mask) {
+ const int p = u_bit_scan(&mask);
+ GLfloat dot = v[0] * ctx->Transform._ClipUserPlane[p][0]
+ + v[1] * ctx->Transform._ClipUserPlane[p][1]
+ + v[2] * ctx->Transform._ClipUserPlane[p][2]
+ + v[3] * ctx->Transform._ClipUserPlane[p][3];
+
+ if (dot < 0.0F) {
+ return 0;
}
}