/**
     * Collapse number down to +1 0 or -1 depending on sign. Typically used in
     * compare routines to collapse a difference of two longs to an int.
     * This is much faster than Sun's Long.signum under Java.exe.
     *
     * @param diff
     *        number to be collapsed to an int preserving sign and zeroness.
     *        usually represents the difference of two long.
     * @return true signum of diff, +1, 0 or -1.
     */
    public static final int signum ( long diff )
        {
        if ( diff > 0 )
            {
            return 1;
            }
        if ( diff < 0 )
            {
            return -1;
            }
        else
            {
            return 0;
            }
        } // end signum

/**
 * alternate to signum for use in compare.
 * Not a true signum, since it returns ints
 * other than +-1. Where there is any possibility of overflow,
 * you should compare two longs with < rather than subtraction.
 * this is five times faster than Sun's Long.signum under Jet.
 *
 * @param diff usually represents the difference of two long.
 *
 * @return signum of diff, some -ve int, 0 or some -ve int.
 *
 */
public static final int signOf ( long diff )
   {
   return ( diff != 0 ) ? ( (int)( diff >>> 32 ) | 1 ) : 0;
   }

/**
 * This is how Sun's Long.signum is implemented.
 * This is slower than either of the two methods above on a Pentium.
 *
 * @param diff usually represents the difference of two long.
 *
 * @return signum of diff, +1, 0 or -1.
 *
 */
public static final int sunSignum ( long diff )
   {
   return (int) ((i >> 63) | (-i >>> 63));
   }