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

Submitted by Emil Velikov on April 24, 2016, 6:22 p.m.

Details

Message ID 1461522177-5796-2-git-send-email-emil.l.velikov@gmail.com
State New
Series "Series without cover letter"
Headers show

Commit Message

Emil Velikov April 24, 2016, 6:22 p.m.
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(-)

Patch hide | download patch | download mbox

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;