public static long findWidth(long start, long end, int numReducers) { return Long.divideUnsigned(end - start, numReducers) + 1; }
@Override public int getPartition(LongWritable longWritable, BytesWritable bytesWritable, int numPartitions) { if (start == null) { initialize(); } long x = longWritable.get(); int ret = (int)Long.divideUnsigned(x - start, width); if (ret > numPartitions) { throw new IllegalArgumentException(String.format("Bad partition: key=%s, width=%d, partition=%d, numPartitions=%d" , Long.toUnsignedString(x), width, ret, numPartitions) ); } return ret; }
public static byte[] addPacketHeader(long tsNano, byte[] packet, Endianness endianness) { boolean swapBytes = swapBytes(endianness); long micros = Long.divideUnsigned(tsNano, 1000); int secs = (int)(micros / 1000000); int usec = (int)(micros % 1000000);
long micros = Long.divideUnsigned(tsNano, 1000); int secs = (int)(micros / 1000000); int usec = (int)(micros % 1000000);
long millis = Long.divideUnsigned(key.get(), 1000000); String ts = DATE_FORMAT.format(new Date(millis)); try {
, SimpleDateFormat.LONG ); String from = format.format(new Date(Long.divideUnsigned(beginNS, 1000000))); String to = format.format(new Date(Long.divideUnsigned(endNS, 1000000))); LOG.debug("Executing query {} on timerange from {} to {}", filterImpl.queryToString(fields), from, to);
public static long f(long x) { long quadratic = 42 * x * x + 19 * x + 47; return Long.divideUnsigned(quadratic, x + 1); } @Benchmark
public static Vec2ul div(Vec2ul res, long aX, long aY, Vec2ul b) { res.x.value = Long.divideUnsigned(aX, b.x.value); res.y.value = Long.divideUnsigned(aY, b.y.value); return res; }
public static Vec2ul div(Vec2ul res, Vec2ul a, long bX, long bY) { res.x.value = Long.divideUnsigned(a.x.value, bX); res.y.value = Long.divideUnsigned(a.y.value, bY); return res; }
public static Vec3ul div(Vec3ul res, Vec3ul a, long bX, long bY, long bZ) { res.x.value = Long.divideUnsigned(a.x.value, bX); res.y.value = Long.divideUnsigned(a.y.value, bY); res.z.value = Long.divideUnsigned(a.z.value, bZ); return res; }
public static Vec4ul div(Vec4ul res, Vec4ul a, long bX, long bY, long bZ, long bW) { res.x.value = Long.divideUnsigned(a.x.value, bX); res.y.value = Long.divideUnsigned(a.y.value, bY); res.z.value = Long.divideUnsigned(a.z.value, bZ); res.w.value = Long.divideUnsigned(a.w.value, bW); return res; }
String.format("%019d%d", Long.divideUnsigned(n, 10), Long.remainderUnsigned(n, 10));
@JTranscSync public static String toUnsignedString(long i, int radix) { if (i == 0) return "0"; StringBuilder out = new StringBuilder(); while (i != 0) { out.append(JTranscCType.encodeDigit((int) Long.remainderUnsigned(i, radix))); i = Long.divideUnsigned(i, radix); } out.reverse(); return out.toString(); }
protected String getXmxValue(int maxInstances) { Long memMax = Long.divideUnsigned(Long.divideUnsigned(getPhysicalMemorySize(), 10) * 8, maxInstances); String maxXmx = "14g"; if (Long.compareUnsigned(memMax, SubstrateOptionsParser.parseLong(maxXmx)) >= 0) { return maxXmx; } return Long.toUnsignedString(memMax); }
protected static long lookupEntryIP(long ip) { return Long.divideUnsigned(ip, indexGranularity()) * indexGranularity(); }
private long loadEntryOffset(long ip) { counters().lookupEntryOffsetCount.inc(); long index = Long.divideUnsigned(ip, indexGranularity()); return ByteArrayReader.getU4(codeInfoIndex, index * Integer.BYTES); }
@Operation(opcode = Opcode.NODE_CLASS_WITH_GUARD, node = UnsignedDivNode.class) public Word unsignedDivide(Word val) { return box(Long.divideUnsigned(unbox(), val.unbox())); }
@Override public void readInputs() throws NodeException { if (signed) { long av = a.getValueSigned(); long bv = b.getValueSigned(); if (bv == 0) bv = 1; q = av / bv; r = av % bv; // make the remainder positive if (r < 0) { if (bv >= 0) { r += bv; q--; } else { r -= bv; q++; } } } else { long av = a.getValue(); long bv = b.getValue(); if (bv == 0) bv = 1; q = Long.divideUnsigned(av, bv); r = Long.remainderUnsigned(av, bv); } }
/** * Compute the raw value of the trip count for this loop. THIS IS AN UNSIGNED VALUE; */ private long rawConstantMaxTripCount() { assert iv.direction() != null; long endValue = end.asJavaConstant().asLong(); long initValue = iv.constantInit(); long range; long absStride; if (iv.direction() == Direction.Up) { if (endValue < initValue) { return 0; } range = endValue - iv.constantInit(); absStride = iv.constantStride(); } else { assert iv.direction() == Direction.Down; if (initValue < endValue) { return 0; } range = iv.constantInit() - endValue; absStride = -iv.constantStride(); } if (oneOff) { range += 1; } long denominator = range + absStride - 1; return Long.divideUnsigned(denominator, absStride); }
@SuppressWarnings("unused") private static ValueNode canonical(UnsignedDivNode self, ValueNode forX, ValueNode forY, GuardingNode zeroCheck, Stamp stamp, NodeView view) { int bits = ((IntegerStamp) stamp).getBits(); if (forX.isConstant() && forY.isConstant()) { long yConst = CodeUtil.zeroExtend(forY.asJavaConstant().asLong(), bits); if (yConst == 0) { /* This will trap, cannot canonicalize. */ return self != null ? self : new UnsignedDivNode(forX, forY, zeroCheck); } return ConstantNode.forIntegerStamp(stamp, Long.divideUnsigned(CodeUtil.zeroExtend(forX.asJavaConstant().asLong(), bits), yConst)); } else if (forY.isConstant()) { long c = CodeUtil.zeroExtend(forY.asJavaConstant().asLong(), bits); if (c == 1) { return forX; } if (CodeUtil.isPowerOf2(c)) { return new UnsignedRightShiftNode(forX, ConstantNode.forInt(CodeUtil.log2(c))); } } return self != null ? self : new UnsignedDivNode(forX, forY, zeroCheck); }