[Pixman] [RFC 2/2] sse2: use uintptr_t for vx/unit_x

Emil Velikov emil.l.velikov at gmail.com
Sun Apr 24 18:22:57 UTC 2016


Strictly speaking this is not correct, as the value itself can be signed
based on the definition of pixman_fixed_t. At the same time we check if
vx can be negative in some places, while in others we directly ">> 16"
and use the result as an index.

Obviously something isn't right here - should we add more checks,
convert to unsigned or there is something which implies that in some
codepaths the variable cannot be negative ?
---

Noticed while looking at the crashes due to previous commit.

---

 pixman/pixman-sse2.c | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/pixman/pixman-sse2.c b/pixman/pixman-sse2.c
index 8955103..67eed84 100644
--- a/pixman/pixman-sse2.c
+++ b/pixman/pixman-sse2.c
@@ -5698,8 +5698,8 @@ scaled_bilinear_scanline_sse2_8888_8888_SRC (uint32_t *       dst,
 					     pixman_fixed_t   max_vx,
 					     pixman_bool_t    zero_src)
 {
-    intptr_t vx = vx_;
-    intptr_t unit_x = unit_x_;
+    uintptr_t vx = vx_;
+    uintptr_t unit_x = unit_x_;
     BILINEAR_DECLARE_VARIABLES;
     uint32_t pix1, pix2;
 
@@ -5763,8 +5763,8 @@ scaled_bilinear_scanline_sse2_x888_8888_SRC (uint32_t *       dst,
 					     pixman_fixed_t   max_vx,
 					     pixman_bool_t    zero_src)
 {
-    intptr_t vx = vx_;
-    intptr_t unit_x = unit_x_;
+    uintptr_t vx = vx_;
+    uintptr_t unit_x = unit_x_;
     BILINEAR_DECLARE_VARIABLES;
     uint32_t pix1, pix2;
 
@@ -5823,8 +5823,8 @@ scaled_bilinear_scanline_sse2_8888_8888_OVER (uint32_t *       dst,
 					      pixman_fixed_t   max_vx,
 					      pixman_bool_t    zero_src)
 {
-    intptr_t vx = vx_;
-    intptr_t unit_x = unit_x_;
+    uintptr_t vx = vx_;
+    uintptr_t unit_x = unit_x_;
     BILINEAR_DECLARE_VARIABLES;
     uint32_t pix1, pix2;
 
@@ -5920,8 +5920,8 @@ scaled_bilinear_scanline_sse2_8888_8_8888_OVER (uint32_t *       dst,
 						pixman_fixed_t   max_vx,
 						pixman_bool_t    zero_src)
 {
-    intptr_t vx = vx_;
-    intptr_t unit_x = unit_x_;
+    uintptr_t vx = vx_;
+    uintptr_t unit_x = unit_x_;
     BILINEAR_DECLARE_VARIABLES;
     uint32_t pix1, pix2;
     uint32_t m;
@@ -6078,8 +6078,8 @@ scaled_bilinear_scanline_sse2_8888_n_8888_OVER (uint32_t *       dst,
 						pixman_fixed_t   max_vx,
 						pixman_bool_t    zero_src)
 {
-    intptr_t vx = vx_;
-    intptr_t unit_x = unit_x_;
+    uintptr_t vx = vx_;
+    uintptr_t unit_x = unit_x_;
     BILINEAR_DECLARE_VARIABLES;
     uint32_t pix1;
     __m128i xmm_mask;
-- 
2.8.0



More information about the Pixman mailing list