java.math.BigInteger.or()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(4.9k)|赞(0)|评价(0)|浏览(234)

本文整理了Java中java.math.BigInteger.or()方法的一些代码示例,展示了BigInteger.or()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。BigInteger.or()方法的具体详情如下:
包路径:java.math.BigInteger
类名称:BigInteger
方法名:or

BigInteger.or介绍

[英]Returns a BigInteger whose value is this | value.

Implementation Note: Usage of this method is not recommended as the current implementation is not efficient.
[中]返回一个BigInteger,其值为该|值。
实施说明:不建议使用此方法,因为当前的实施效率不高。

代码示例

代码示例来源:origin: web3j/web3j

static BigInteger convert(int mBitSize, int nBitSize, BigInteger m, BigInteger n) {
    BigInteger mPadded = m.shiftLeft(nBitSize);
    int nBitLength = n.bitLength();

    // find next multiple of 4
    int shift = (nBitLength + 3) & ~0x03;
    return mPadded.or(n.shiftLeft(nBitSize - shift));
  }
}

代码示例来源:origin: plutext/docx4j

private static BigInteger getFrac(long rawBits) {
  return BigInteger.valueOf(rawBits).and(BI_FRAC_MASK).or(BI_IMPLIED_FRAC_MSB).shiftLeft(11);
}

代码示例来源:origin: org.apache.poi/poi

private static BigInteger getFrac(long rawBits) {
  return BigInteger.valueOf(rawBits).and(BI_FRAC_MASK).or(BI_IMPLIED_FRAC_MSB).shiftLeft(11);
}

代码示例来源:origin: org.codehaus.groovy/groovy

protected Number orImpl(Number left, Number right) {
  return toBigInteger(left).or(toBigInteger(right));
}

代码示例来源:origin: net.java.dev.jna/jna

private static BigInteger readULEB128(ByteBuffer buffer) {
    BigInteger result = BigInteger.ZERO;
    int shift = 0;
    while (true) {
      byte b = buffer.get();
      result = result.or(BigInteger.valueOf(b & 127).shiftLeft(shift));
      if ((b & 128) == 0) {
        break;
      }
      shift += 7;
    }
    return result;
  }
}

代码示例来源:origin: hcoles/pitest

@Override
 BigInteger apply(BigInteger left, BigInteger right) {
  return left.or(right);
 }
}

代码示例来源:origin: killme2008/aviator

@Override
protected AviatorObject innerBitOr(AviatorObject other) {
 return AviatorBigInt.valueOf(this.toBigInt().or(((AviatorNumber) other).toBigInt()));
}

代码示例来源:origin: i2p/i2p.i2p

variance = variance.or(BigInteger.valueOf(fixedBits).shiftLeft(begin - fixed));
} else {
    nonz = nonz.shiftLeft(begin);
  variance = variance.or(nonz);

代码示例来源:origin: batfish/batfish

private static BigInteger numSubnetBitsToSubnetBigInteger(int numBits) {
 BigInteger val = BigInteger.ZERO;
 for (int i = Prefix6.MAX_PREFIX_LENGTH - 1; i > Prefix6.MAX_PREFIX_LENGTH - 1 - numBits; i--) {
  val = val.or(BigInteger.ONE.shiftLeft(i));
 }
 return val;
}

代码示例来源:origin: org.apache.felix/org.apache.felix.gogo.runtime

@Override
  public BigDecimal eval(BigDecimal v1, BigDecimal v2) {
    return new BigDecimal(v1.toBigInteger().or(v2.toBigInteger()), mc);
  }
});

代码示例来源:origin: org.apache.felix/org.apache.felix.gogo.runtime

@Override
  public BigDecimal eval(BigDecimal v1, BigDecimal v2) {
    return new BigDecimal(v1.toBigInteger().or(v2.toBigInteger()), mc);
  }
});

代码示例来源:origin: apache/felix

@Override
  public BigDecimal eval(BigDecimal v1, BigDecimal v2) {
    return new BigDecimal(v1.toBigInteger().or(v2.toBigInteger()), mc);
  }
});

代码示例来源:origin: org.jruby/jruby-complete

private double intPairToRealInclusive(int a, int b) {
  BigInteger c = BigInteger.valueOf(a & 0xffffffffL);
  BigInteger d = BigInteger.valueOf(b & 0xffffffffL);
  return c.shiftLeft(32).or(d).multiply(INTPAIR_CONST).shiftRight(64).doubleValue()
      * LDEXP_CONST;
}

代码示例来源:origin: apache/cxf

private BigInteger convertLongToULong(long l) {
  if (l < 0) {
    long l2 = l & 0x7FFFFFFFFFFFFFL;
    BigInteger i = BigInteger.valueOf(l2);
    BigInteger i2 = BigInteger.valueOf(0);
    i2 = i2.setBit(63);
    i = i.or(i2);
    return i;
  }
  return BigInteger.valueOf(l);
}
public BigInteger readULongLong() throws CorbaBindingException {

代码示例来源:origin: actiontech/dble

/**
 * or's push-down isor
 */
@Override
public boolean pushDownAdd(RowDataPacket row) {
  BigInteger value = args.get(0).valInt();
  if (!args.get(0).isNullValue())
    bits = bits.or(value);
  return false;
}

代码示例来源:origin: DragonetMC/DragonProxy

public void writeVar(BigInteger v) throws IOException {
  v = v.and(UNSIGNED_LONG_MAX_VALUE);
  BigInteger i = BigInteger.valueOf(-128);
  BigInteger BIX7F = BigInteger.valueOf(0x7f);
  BigInteger BIX80 = BigInteger.valueOf(0x80);
  while (!v.and(i).equals(BigInteger.ZERO)) {
    writeByte(v.and(BIX7F).or(BIX80).byteValue());
    v = v.shiftRight(7);
  }
  writeByte(v.byteValue());
}

代码示例来源:origin: TeamWalrus/Walrus

protected BigInteger applyAtMyPos(BigInteger target, BigInteger value) {
  if (length != null) {
    target = target.andNot(lengthMask().shiftLeft(startPos));
    value = value.and(lengthMask());
  }
  return target.or(value.shiftLeft(startPos));
}

代码示例来源:origin: batfish/batfish

public boolean contains(Ip6 ip) {
 BigInteger wildcardIpAsBigInteger = getIp().asBigInteger();
 BigInteger wildcardMask = getWildcard().asBigInteger();
 BigInteger ipAsBigInteger = ip.asBigInteger();
 BigInteger maskedIpAsBigInteger = ipAsBigInteger.or(wildcardMask);
 BigInteger maskedWildcard = wildcardIpAsBigInteger.or(wildcardMask);
 return maskedIpAsBigInteger.equals(maskedWildcard);
}

代码示例来源:origin: ognl/ognl

public static Object binaryOr(Object v1, Object v2)
{
  int type = getNumericType(v1, v2);
  if (type == BIGINT || type == BIGDEC) return bigIntValue(v1).or(bigIntValue(v2));
  return newInteger(type, longValue(v1) | longValue(v2));
}

代码示例来源:origin: zycgit/hasor

/** 或 */
public static Number or(Number obj1, Number obj2) {
  checkDecimal(obj1, obj2);
  int numericType = getNumericType(obj1, obj2);
  if (numericType <= LONG) {
    return longValue(obj1) | longValue(obj2);
  } else {
    return bigIntValue(obj1).or(bigIntValue(obj2));
  }
}
/** 异或 */

相关文章