Commits

Chuck Adams  committed 128ba11

inlined intsignum for al dente copypasta goodness

  • Participants
  • Parent commits 0e3e64a

Comments (0)

Files changed (1)

File src/main/java/net/fishbulb/jcod/util/PlotAlgorithms.java

         boolean apply(int x, int y);
     }
 
-    private static int intsignum(int a) {
-        return ((a < 0) ? -1 : (a > 0) ? 1 : 0);
-    }
-
     /** Bresenham algorithm implementation adapted from SquidLib. */
     public static void bresenham(int x1, int y1, int x2, int y2, PlotFunction plot) {
         int xd, yd;
         ax = Math.abs(dx) << 1;
         ay = Math.abs(dy) << 1;
 
-        sx = intsignum(dx);
-        sy = intsignum(dy);
+        sx = ((dx < 0) ? -1 : (dx > 0) ? 1 : 0);
+        sy = ((dy < 0) ? -1 : (dy > 0) ? 1 : 0);
 
         x = x1;
         y = y1;