code: static long x(long d, long m, long over) {
           if (d >  over) return Long.MAX_VALUE;
           if (d < -over) return Long.MIN_VALUE;
           return d * m;
       }
docs: Scale d by m, checking for overflow.
  This has a short name to make above code more readable.