summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBhanu Chetlapalli2012-01-25 16:45:30 -0600
committerBhanu Chetlapalli2012-01-25 16:45:30 -0600
commit65026f980a6df01a7d437ce51a47de911820041e (patch)
treeea4b70a8a4fcc4b1f88e83a86136001b620cbc62 /libpixelflinger
parent149ae11fb63818b470156e1652abfad0e08d486d (diff)
downloadplatform-system-core-65026f980a6df01a7d437ce51a47de911820041e.tar.gz
platform-system-core-65026f980a6df01a7d437ce51a47de911820041e.tar.xz
platform-system-core-65026f980a6df01a7d437ce51a47de911820041e.zip
Prevent bit shifting if num bits is negative
Causes OpenGL Software Renderer to generate incorrect window coordinates on MIPS & possibly x86 Change-Id: I3c51b6a5a4e6af75e9b31d9d47e4e4d894825888 Signed-off-by: Bhanu Chetlapalli <bhanu@mips.com>
Diffstat (limited to 'libpixelflinger')
-rw-r--r--libpixelflinger/fixed.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/libpixelflinger/fixed.cpp b/libpixelflinger/fixed.cpp
index 5b920628b..509453776 100644
--- a/libpixelflinger/fixed.cpp
+++ b/libpixelflinger/fixed.cpp
@@ -62,7 +62,8 @@ int32_t gglRecipQ(GGLfixed x, int q)
62 int shift; 62 int shift;
63 x = gglRecipQNormalized(x, &shift); 63 x = gglRecipQNormalized(x, &shift);
64 shift += 16-q; 64 shift += 16-q;
65 x += 1L << (shift-1); // rounding 65 if (shift > 0)
66 x += 1L << (shift-1); // rounding
66 x >>= shift; 67 x >>= shift;
67 return x; 68 return x;
68} 69}