summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--libpixelflinger/fixed.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/libpixelflinger/fixed.cpp b/libpixelflinger/fixed.cpp
index 5b92062..5094537 100644
--- a/libpixelflinger/fixed.cpp
+++ b/libpixelflinger/fixed.cpp
@@ -62,7 +62,8 @@ int32_t gglRecipQ(GGLfixed x, int q)
int shift;
x = gglRecipQNormalized(x, &shift);
shift += 16-q;
- x += 1L << (shift-1); // rounding
+ if (shift > 0)
+ x += 1L << (shift-1); // rounding
x >>= shift;
return x;
}