llvmpipe: replace shifts with multiplies to be clearer
authorBrian Paul <brianp@vmware.com>
Tue, 1 Dec 2009 22:51:07 +0000 (15:51 -0700)
committerBrian Paul <brianp@vmware.com>
Tue, 1 Dec 2009 23:00:30 +0000 (16:00 -0700)
The compiler will still do the multiplies with shifts.
It's just a bit easier to follow the logic with multiplies.

src/gallium/drivers/llvmpipe/lp_rast_tri.c

index 07b0eccf1e71d5049ee44cceadad8dbbdfca32ea..9543b86ecd98a66666076f10490e6e9184f4d4a3 100644 (file)
@@ -120,22 +120,22 @@ do_block_16( struct lp_rasterizer *rast,
 {
    int ix, iy, i = 0;
 
-   int ei1 = tri->ei1 << 2;
-   int ei2 = tri->ei2 << 2;
-   int ei3 = tri->ei3 << 2;
+   int ei1 = tri->ei1 * 4;
+   int ei2 = tri->ei2 * 4;
+   int ei3 = tri->ei3 * 4;
 
-   int eo1 = tri->eo1 << 2;
-   int eo2 = tri->eo2 << 2;
-   int eo3 = tri->eo3 << 2;
+   int eo1 = tri->eo1 * 4;
+   int eo2 = tri->eo2 * 4;
+   int eo3 = tri->eo3 * 4;
 
    assert(x % 16 == 0);
    assert(y % 16 == 0);
 
    for (iy = 0; iy < 16; iy+=4) {
       for (ix = 0; ix < 16; ix+=4, i++) {
-        int cx1 = c1 + (tri->step[0][i] << 2);
-        int cx2 = c2 + (tri->step[1][i] << 2);
-        int cx3 = c3 + (tri->step[2][i] << 2);
+        int cx1 = c1 + (tri->step[0][i] * 4);
+        int cx2 = c2 + (tri->step[1][i] * 4);
+        int cx3 = c3 + (tri->step[2][i] * 4);
         
         if (cx1 + eo1 < 0 ||
             cx2 + eo2 < 0 ||
@@ -176,13 +176,13 @@ lp_rast_triangle( struct lp_rasterizer *rast,
    int c2 = tri->c2 + tri->dx23 * y - tri->dy23 * x;
    int c3 = tri->c3 + tri->dx31 * y - tri->dy31 * x;
 
-   int ei1 = tri->ei1 << 4;
-   int ei2 = tri->ei2 << 4;
-   int ei3 = tri->ei3 << 4;
+   int ei1 = tri->ei1 * 16;
+   int ei2 = tri->ei2 * 16;
+   int ei3 = tri->ei3 * 16;
 
-   int eo1 = tri->eo1 << 4;
-   int eo2 = tri->eo2 << 4;
-   int eo3 = tri->eo3 << 4;
+   int eo1 = tri->eo1 * 16;
+   int eo2 = tri->eo2 * 16;
+   int eo3 = tri->eo3 * 16;
 
    debug_printf("%s\n", __FUNCTION__);
 
@@ -194,9 +194,9 @@ lp_rast_triangle( struct lp_rasterizer *rast,
     */
    for (iy = 0; iy < TILE_SIZE; iy += 16) {
       for (ix = 0; ix < TILE_SIZE; ix += 16, i++) {
-        int cx1 = c1 + (tri->step[0][i] << 4);
-        int cx2 = c2 + (tri->step[1][i] << 4);
-        int cx3 = c3 + (tri->step[2][i] << 4);
+        int cx1 = c1 + (tri->step[0][i] * 16);
+        int cx2 = c2 + (tri->step[1][i] * 16);
+        int cx3 = c3 + (tri->step[2][i] * 16);
         
         if (cx1 + eo1 < 0 ||
             cx2 + eo2 < 0 ||