core/src/main/java/org/jruby/RubyNumeric.java
public static long num2ulong(IRubyObject arg) {
        // loop until we have a Numeric
        while (true) {
            if (arg instanceof RubyFixnum) {
                return ((RubyFixnum) arg).value;
            } else if (arg instanceof RubyBignum) {
                return RubyBignum.big2ulong((RubyBignum) arg);
            } else if (arg instanceof RubyFloat) {
                return float2ulong((RubyFloat) arg);
            } else {
                if (arg.isNil()) {
                    throw arg.getRuntime().newTypeError("no implicit conversion from nil to integer");
                }
                arg = arg.convertToInteger();
                // loop again
            }
        }
    }
/**
     * Convert the given value into an unsigned long, encoded as a signed long.
     *
     * Because we can't represent an unsigned long directly in Java, callers of this code must deal with the signed
     * long bits accordingly.
     *
     * @param arg the argument to convert
     * @return an unsigned long encoded as a signed long, or raise an error if out of range
     */
Convert the given value into an unsigned long, encoded as a signed long.
Because we can't represent an unsigned long directly in Java, callers of this code must deal with the signed
long bits accordingly.

@param arg the argument to convert
@return an unsigned long encoded as a signed long, or raise an error if out of range
Convert the given value into an unsigned long encoded as a signed long . Because we can ' t represent an unsigned long directly in Java callers of this code must deal with the signed long bits accordingly . @param arg the argument to convert @return an unsigned long encoded as a signed long or raise an error if out of range
public static long num2ulong(IRubyObject arg) {
        while (true) {
            if (arg instanceof RubyFixnum) {
                return ((RubyFixnum) arg).value;
            } else if (arg instanceof RubyBignum) {
                return RubyBignum.big2ulong((RubyBignum) arg);
            } else if (arg instanceof RubyFloat) {
                return float2ulong((RubyFloat) arg);
            } else {
                if (arg.isNil()) {
                    throw arg.getRuntime().newTypeError("no implicit conversion from nil to integer");
                }
                arg = arg.convertToInteger();
            }
        }
    }
public static long num2ulong ( IRubyObject arg ) { while ( true ) { if ( arg instanceof RubyFixnum ) { return ( ( RubyFixnum ) arg ) . value ; } else if ( arg instanceof RubyBignum ) { return RubyBignum . big2ulong ( ( RubyBignum ) arg ) ; } else if ( arg instanceof RubyFloat ) { return float2ulong ( ( RubyFloat ) arg ) ; } else { if ( arg . isNil ( ) ) { throw arg . getRuntime ( ) . newTypeError ( "no implicit conversion from nil to integer" ) ; } arg = arg . convertToInteger ( ) ; } } }
Convert the given value into an unsigned long, encoded as a signed long.
Convert the given value into an unsigned long encoded as a signed long .
// loop until we have a Numeric // loop again