public static Vec2ub div(Vec2ub res, Vec2ub a, int bX, int bY) { res.x.value = (byte) Integer.divideUnsigned(a.x.value & 0xff, bX); res.y.value = (byte) Integer.divideUnsigned(a.y.value & 0xff, bY); return res; }
public static Vec4ub div(Vec4ub res, Vec4ub a, int bX, int bY, int bZ, int bW) { res.x.value = (byte) Integer.divideUnsigned(a.x.value & 0xff, bX); res.y.value = (byte) Integer.divideUnsigned(a.y.value & 0xff, bY); res.z.value = (byte) Integer.divideUnsigned(a.z.value & 0xff, bZ); res.w.value = (byte) Integer.divideUnsigned(a.w.value & 0xff, bW); return res; }
public static Vec2ub div(Vec2ub res, int aX, int aY, Vec2ub b) { res.x.value = (byte) Integer.divideUnsigned(aX, b.x.value & 0xff); res.y.value = (byte) Integer.divideUnsigned(aY, b.y.value & 0xff); return res; }
public static Vec3ub div(Vec3ub res, Vec3ub a, int bX, int bY, int bZ) { res.x.value = (byte) Integer.divideUnsigned(a.x.value & 0xff, bX); res.y.value = (byte) Integer.divideUnsigned(a.y.value & 0xff, bY); res.z.value = (byte) Integer.divideUnsigned(a.z.value & 0xff, bZ); return res; }
public static Vec4us div(Vec4us res, int aX, int aY, int aZ, int aW, Vec4us b) { res.x.value = (short) Integer.divideUnsigned(aX, b.x.value & 0xffff); res.y.value = (short) Integer.divideUnsigned(aY, b.y.value & 0xffff); res.z.value = (short) Integer.divideUnsigned(aZ, b.z.value & 0xffff); res.w.value = (short) Integer.divideUnsigned(aW, b.w.value & 0xffff); return res; } }
public static Vec2us div(Vec2us res, Vec2us a, int bX, int bY) { res.x.value = (short) Integer.divideUnsigned(a.x.value & 0xffff, bX); res.y.value = (short) Integer.divideUnsigned(a.y.value & 0xffff, bY); return res; }
public static Vec3ui div(Vec3ui res, Vec3ui a, int bX, int bY, int bZ) { res.x.value = Integer.divideUnsigned(a.x.value, bX); res.y.value = Integer.divideUnsigned(a.y.value, bY); res.z.value = Integer.divideUnsigned(a.z.value, bZ); return res; }
public static Vec3us div(Vec3us res, Vec3us a, int bX, int bY, int bZ) { res.x.value = (short) Integer.divideUnsigned(a.x.value & 0xffff, bX); res.y.value = (short) Integer.divideUnsigned(a.y.value & 0xffff, bY); res.z.value = (short) Integer.divideUnsigned(a.z.value & 0xffff, bZ); return res; }
public static Vec4ui div(Vec4ui res, Vec4ui a, int bX, int bY, int bZ, int bW) { res.x.value = Integer.divideUnsigned(a.x.value, bX); res.y.value = Integer.divideUnsigned(a.y.value, bY); res.z.value = Integer.divideUnsigned(a.z.value, bZ); res.w.value = Integer.divideUnsigned(a.w.value, bW); return res; }
public static Vec3us div(Vec3us res, int aX, int aY, int aZ, Vec3us b) { res.x.value = (short) Integer.divideUnsigned(aX, b.x.value & 0xffff); res.y.value = (short) Integer.divideUnsigned(aY, b.y.value & 0xffff); res.z.value = (short) Integer.divideUnsigned(aZ, b.z.value & 0xffff); return res; }
public static Vec2ui div(Vec2ui res, Vec2ui a, int bX, int bY) { res.x.value = Integer.divideUnsigned(a.x.value, bX); res.y.value = Integer.divideUnsigned(a.y.value, bY); return res; }
public static Vec4us div(Vec4us res, Vec4us a, int bX, int bY, int bZ, int bW) { res.x.value = (short) Integer.divideUnsigned(a.x.value & 0xffff, bX); res.y.value = (short) Integer.divideUnsigned(a.y.value & 0xffff, bY); res.z.value = (short) Integer.divideUnsigned(a.z.value & 0xffff, bZ); res.w.value = (short) Integer.divideUnsigned(a.w.value & 0xffff, bW); return res; }
public static Vec2ui div(Vec2ui res, int aX, int aY, Vec2ui b) { res.x.value = Integer.divideUnsigned(aX, b.x.value); res.y.value = Integer.divideUnsigned(aY, b.y.value); return res; }
public static Vec2us div(Vec2us res, int aX, int aY, Vec2us b) { res.x.value = (short) Integer.divideUnsigned(aX, b.x.value & 0xffff); res.y.value = (short) Integer.divideUnsigned(aY, b.y.value & 0xffff); return res; }
public static Vec3ub div(Vec3ub res, int aX, int aY, int aZ, Vec3ub b) { res.x.value = (byte) Integer.divideUnsigned(aX, b.x.value & 0xff); res.y.value = (byte) Integer.divideUnsigned(aY, b.y.value & 0xff); res.z.value = (byte) Integer.divideUnsigned(aZ, b.z.value & 0xff); return res; }
public static Vec4ub div(Vec4ub res, int aX, int aY, int aZ, int aW, Vec4ub b) { res.x.value = (byte) Integer.divideUnsigned(aX, b.x.value & 0xff); res.y.value = (byte) Integer.divideUnsigned(aY, b.y.value & 0xff); res.z.value = (byte) Integer.divideUnsigned(aZ, b.z.value & 0xff); res.w.value = (byte) Integer.divideUnsigned(aW, b.w.value & 0xff); return res; }
public static final int computeWcu(final int bytes) { return Math.max(1, Integer.divideUnsigned(bytes, ONE_KILOBYTE)); }
public static IntStream intRange(int startInclusive, int endExclusive, int step) { if(step == 0) throw new IllegalArgumentException("step = 0"); if(step == 1) return IntStream.range(startInclusive, endExclusive); if(step == -1) { // Handled specially as number of elements can exceed Integer.MAX_VALUE int sum = endExclusive+startInclusive; return IntStream.range(endExclusive, startInclusive).map(x -> sum - x); } if((endExclusive > startInclusive ^ step > 0) || endExclusive == startInclusive) return IntStream.empty(); int limit = (endExclusive-startInclusive)*Integer.signum(step)-1; limit = Integer.divideUnsigned(limit, Math.abs(step)); return IntStream.rangeClosed(0, limit).map(x -> x * step + startInclusive); }
int fun(int a, int b) { // You need to get the value as a string first, there is no nextUnsignedInt in Scanner int x = Integer.parseUnsignedInt(new java.util.Scanner(System.in).next()); return a*x + Integer.divideUnsigned(b, 2); }
@JTranscMethodBody(target = "js", value = "return N.str((p0 >>> 0).toString(p1));") @JTranscMethodBody(target = "as3", value = "return N.str(uint(p0).toString(p1));") @JTranscSync public static String toUnsignedString(int i, int radix) { if (i == 0) return "0"; StringBuilder out = new StringBuilder(); while (i != 0) { out.append(JTranscCType.encodeDigit(Integer.remainderUnsigned(i, radix))); i = Integer.divideUnsigned(i, radix); } out.reverse(); return out.toString(); }