Tabnine Logo
RubyBignum.num2long
Code IndexAdd Tabnine to your IDE (free)

How to use
num2long
method
in
org.jruby.RubyBignum

Best Java code snippets using org.jruby.RubyBignum.num2long (Showing top 4 results out of 315)

origin: org.jruby/jruby-core

/** rb_big_aref
 *
 */
@Override
public RubyFixnum op_aref(ThreadContext context, IRubyObject other) {
  if (other instanceof RubyBignum) {
    // Need to normalize first
    other = bignorm(context.runtime, ((RubyBignum) other).value);
    if (other instanceof RubyBignum) {
      // '!=' for negative value
      if ((((RubyBignum) other).value.signum() >= 0) != (value.signum() == -1)) {
        return RubyFixnum.zero(context.runtime);
      }
      return RubyFixnum.one(context.runtime);
    }
  }
  long position = num2long(other);
  if (position < 0 || position > Integer.MAX_VALUE) {
    return RubyFixnum.zero(context.runtime);
  }
  return value.testBit((int)position) ? RubyFixnum.one(context.runtime) : RubyFixnum.zero(context.runtime);
}
origin: org.jruby/jruby-complete

/** rb_big_aref
 *
 */
@Override
public RubyFixnum op_aref(ThreadContext context, IRubyObject other) {
  if (other instanceof RubyBignum) {
    // Need to normalize first
    other = bignorm(context.runtime, ((RubyBignum) other).value);
    if (other instanceof RubyBignum) {
      // '!=' for negative value
      if ((((RubyBignum) other).value.signum() >= 0) != (value.signum() == -1)) {
        return RubyFixnum.zero(context.runtime);
      }
      return RubyFixnum.one(context.runtime);
    }
  }
  long position = num2long(other);
  if (position < 0 || position > Integer.MAX_VALUE) {
    return RubyFixnum.zero(context.runtime);
  }
  return value.testBit((int)position) ? RubyFixnum.one(context.runtime) : RubyFixnum.zero(context.runtime);
}
origin: com.ning.billing/killbill-osgi-bundles-jruby

/** rb_big_aref
 *
 */
@JRubyMethod(name = "[]", required = 1)
public RubyFixnum op_aref(IRubyObject other) {
  if (other instanceof RubyBignum) {
    // Need to normalize first
    other = bignorm(getRuntime(), ((RubyBignum) other).value);
    if (other instanceof RubyBignum) {
      // '!=' for negative value
      if ((((RubyBignum) other).value.signum() >= 0) != (value.signum() == -1)) {
        return RubyFixnum.zero(getRuntime());
      }
      return RubyFixnum.one(getRuntime());
    }
  }
  long position = num2long(other);
  if (position < 0 || position > Integer.MAX_VALUE) {
    return RubyFixnum.zero(getRuntime());
  }
  return value.testBit((int)position) ? RubyFixnum.one(getRuntime()) : RubyFixnum.zero(getRuntime());
}
origin: org.kill-bill.billing/killbill-osgi-bundles-jruby

/** rb_big_aref
 *
 */
@JRubyMethod(name = "[]", required = 1)
public RubyFixnum op_aref(IRubyObject other) {
  if (other instanceof RubyBignum) {
    // Need to normalize first
    other = bignorm(getRuntime(), ((RubyBignum) other).value);
    if (other instanceof RubyBignum) {
      // '!=' for negative value
      if ((((RubyBignum) other).value.signum() >= 0) != (value.signum() == -1)) {
        return RubyFixnum.zero(getRuntime());
      }
      return RubyFixnum.one(getRuntime());
    }
  }
  long position = num2long(other);
  if (position < 0 || position > Integer.MAX_VALUE) {
    return RubyFixnum.zero(getRuntime());
  }
  return value.testBit((int)position) ? RubyFixnum.one(getRuntime()) : RubyFixnum.zero(getRuntime());
}
org.jrubyRubyBignumnum2long

Popular methods of RubyBignum

  • newBignum
  • getLongValue
  • getValue
    Getter for property value.
  • <init>
  • addFloat
  • addOther
  • big2dbl
    rb_big2dbl
  • big2long
    rb_big2long
  • bignorm
    rb_big_norm
  • checkShiftDown
  • coerceBin
  • coerceCmp
  • coerceBin,
  • coerceCmp,
  • compareTo,
  • convertToDouble,
  • createBignumClass,
  • dbl_cmp,
  • divmod,
  • even_p,
  • fix2big,
  • getBigIntegerValue

Popular in Java

  • Making http requests using okhttp
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • addToBackStack (FragmentTransaction)
  • onRequestPermissionsResult (Fragment)
  • Color (java.awt)
    The Color class is used to encapsulate colors in the default sRGB color space or colors in arbitrary
  • Timestamp (java.sql)
    A Java representation of the SQL TIMESTAMP type. It provides the capability of representing the SQL
  • Timer (java.util)
    Timers schedule one-shot or recurring TimerTask for execution. Prefer java.util.concurrent.Scheduled
  • ZipFile (java.util.zip)
    This class provides random read access to a zip file. You pay more to read the zip file's central di
  • HttpServletRequest (javax.servlet.http)
    Extends the javax.servlet.ServletRequest interface to provide request information for HTTP servlets.
  • IsNull (org.hamcrest.core)
    Is the value null?
  • Top plugins for Android Studio
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now