now that 8c can handle vlong expressions consistently, revert to the sources version for these gs files Reference: /n/atom/patch/applied2013/gsrevert Date: Wed Jun 19 03:52:57 CES 2013 Signed-off-by: quanstro@quanstro.net --- /sys/src/cmd/gs/src/gdevddrw.c Wed Jun 19 03:52:31 2013 +++ /sys/src/cmd/gs/src/gdevddrw.c Wed Jun 19 03:52:31 2013 @@ -562,11 +562,8 @@ { fixed dx1 = p1->x - p0->x, dy1 = p1->y - p0->y; fixed dx2 = p2->x - p0->x, dy2 = p2->y - p0->y; - int64_t xx, yy; - xx = (int64_t)dx1 * dy2; - yy = (int64_t)dx2 * dy1; - if (xx < yy) { + if ((int64_t)dx1 * dy2 < (int64_t)dx2 * dy1) { const gs_fixed_point *p = p1; const frac31 *c = c1; --- /sys/src/cmd/gs/src/gxfill.c Wed Jun 19 03:52:31 2013 +++ /sys/src/cmd/gs/src/gxfill.c Wed Jun 19 03:52:31 2013 @@ -1645,11 +1645,8 @@ but the code with int64_t isn't much better. */ int64_t w0 = coord_weight(endp); int64_t w1 = coord_weight(alp); - int64_t a, b; - a = w0 * nx0; - b = w1 * nx1; - nx = (fixed)((a + b) / (w0 + w1)); + nx = (fixed)((w0 * nx0 + w1 * nx1) / (w0 + w1)); } else nx = nx0; } --- /sys/src/cmd/gs/src/gxshade6.c Wed Jun 19 03:52:31 2013 +++ /sys/src/cmd/gs/src/gxshade6.c Wed Jun 19 03:52:31 2013 @@ -784,12 +784,8 @@ } else if (s2 * s3 < 0) { /* The intersection definitely exists, so the determinant isn't zero. */ fixed d23x = dx3 - dx2, d23y = dy3 - dy2; - int64_t a = (int64_t)dx1 * d23y; - int64_t b = (int64_t)dy1 * d23x; - int64_t det = a - b; - int64_t c = (int64_t)dx2 * d23y; - int64_t d = (int64_t)dy2 * d23x; - int64_t mul = c- d; + int64_t det = (int64_t)dx1 * d23y - (int64_t)dy1 * d23x; + int64_t mul = (int64_t)dx2 * d23y - (int64_t)dy2 * d23x; # define USE_DOUBLE 0 # define USE_INT64_T (1 || !USE_DOUBLE) # if USE_DOUBLE @@ -1232,17 +1228,13 @@ else vd_quad(q[0].y, q[0].x, q[1].y, q[1].x, q[3].y, q[3].x, q[2].y, q[2].x, 0, RGB(255, 0, 0)); #endif - int64_t a = (int64_t)dx1 * dy2; - int64_t b = (int64_t)dy1 * dx2; - if (a != b) { - orient = a > b; + if ((int64_t)dx1 * dy2 != (int64_t)dy1 * dx2) { + orient = ((int64_t)dx1 * dy2 > (int64_t)dy1 * dx2); return linear_color_trapezoid(pfs, q, 0, 1, 2, 3, ybot, ytop, swap_axes, c0, c1, orient); } else { fixed dx3 = q[3].x - q[0].x, dy3 = q[3].y - q[0].y; - int64_t a = (int64_t)dx1 * dy3; - int64_t b = (int64_t)dy1 * dx3; - orient = a > b; + orient = ((int64_t)dx1 * dy3 > (int64_t)dy1 * dx3); return linear_color_trapezoid(pfs, q, 0, 1, 2, 3, ybot, ytop, swap_axes, c0, c1, orient); } } @@ -1673,14 +1665,8 @@ fill_triangle_wedge(patch_fill_state_t *pfs, const shading_vertex_t *q0, const shading_vertex_t *q1, const shading_vertex_t *q2) { - int64_t a = q1->p.x - q0->p.x; - int64_t b = q2->p.y - q0->p.y; - int64_t c = q1->p.y - q0->p.y; - int64_t d = q2->p.x - q0->p.x; - - a *= b; - c *= d; - if (a == c) + if ((int64_t)(q1->p.x - q0->p.x) * (q2->p.y - q0->p.y) == + (int64_t)(q1->p.y - q0->p.y) * (q2->p.x - q0->p.x)) return 0; /* Zero area. */ draw_triangle(&q0->p, &q1->p, &q2->p, RGB(255, 255, 0)); /* @@ -2007,11 +1993,7 @@ dy0 = le.end.y - le.start.y; dx1 = re.end.x - re.start.x; dy1 = re.end.y - re.start.y; - - int64_t a = (int64_t)dx0 * dy1; - int64_t b = (int64_t)dy0 * dx1; - - if (a < b) + if ((int64_t)dx0 * dy1 < (int64_t)dy0 * dx1) return ordered_triangle(pfs, &le, &re, &c); else return ordered_triangle(pfs, &re, &le, &c); @@ -2095,9 +2077,7 @@ } } } - uint64_t a = (int64_t)dx1 * dy3; - uint64_t b = (int64_t)dy1 * dx3; - orient = a > b; + orient = ((int64_t)dx1 * dy3 > (int64_t)dy1 * dx3); } if (q[1].y <= q[2].y && q[2].y <= q[3].y) { if (self_intersecting && intersection_of_small_bars(q, 0, 3, 1, 2, &ry, &ey)) { @@ -2559,9 +2539,7 @@ int code; fixed d01x = p1->p.x - p0->p.x, d01y = p1->p.y - p0->p.y; fixed d12x = p2->p.x - p1->p.x, d12y = p2->p.y - p1->p.y; - int64_t a = (int64_t)d01x * d12y; - int64_t b = (int64_t)d01y * d12x; - int64_t s1 = a - b; + int64_t s1 = (int64_t)d01x * d12y - (int64_t)d01y * d12x; gx_path_init_local(&path, pdev->memory); code = gx_path_add_point(&path, p0->p.x, p0->p.y); @@ -3175,9 +3153,7 @@ vector_pair_orientation(const gs_fixed_point *p0, const gs_fixed_point *p1, const gs_fixed_point *p2) { fixed dx1 = p1->x - p0->x, dy1 = p1->y - p0->y; fixed dx2 = p2->x - p0->x, dy2 = p2->y - p0->y; - int64_t a = (int64_t)dx1; - int64_t b = dy2 - (int64_t)dy1 * dx2; - int64_t vp = a * b; + int64_t vp = (int64_t)dx1 * dy2 - (int64_t)dy1 * dx2; return (vp > 0 ? 1 : vp < 0 ? -1 : 0); } @@ -3527,12 +3503,8 @@ fixed d23y = (curve[3].vertex.p.y - curve[2].vertex.p.y) >> 1; fixed d30x = (curve[0].vertex.p.x - curve[3].vertex.p.x) >> 1; fixed d30y = (curve[0].vertex.p.y - curve[3].vertex.p.y) >> 1; - int64_t a = (int64_t)d01x * d12y; - int64_t b = (int64_t)d01y * d12x; - int64_t s1 = a - b; - int64_t c = (int64_t)d23x * d30y; - int64_t d = (int64_t)d23y * d30x; - int64_t s2 = c - d; + int64_t s1 = (int64_t)d01x * d12y - (int64_t)d01y * d12x; + int64_t s2 = (int64_t)d23x * d30y - (int64_t)d23y * d30x; int s = (s1 + s2 > 0 ? 1 : 3), i, j, k, jj, l = (s == 1 ? 0 : 1); gx_path_init_local(&path, pdev->memory);