public static int toUint16(Object arg) { int iv; if (arg instanceof Integer) { iv = ((Integer)arg); } else { iv = ScriptRuntime.toInt32(arg); } return iv % SIXTEEN_BIT; }
public static int toUint8(Object arg) { int iv; if (arg instanceof Integer) { iv = ((Integer)arg); } else { iv = ScriptRuntime.toInt32(arg); } return iv % EIGHT_BIT; }
public static int toInt8(Object arg) { int iv; if (arg instanceof Integer) { iv = (Integer)arg; } else { iv = ScriptRuntime.toInt32(arg); } int int8Bit = iv % EIGHT_BIT; return (int8Bit >= (1 << 7)) ? (int8Bit - EIGHT_BIT) : int8Bit; }
public static int toInt16(Object arg) { int iv; if (arg instanceof Integer) { iv = ((Integer)arg); } else { iv = ScriptRuntime.toInt32(arg); } int int16Bit = iv % SIXTEEN_BIT; return (int16Bit >= (1 << 15)) ? (int16Bit - SIXTEEN_BIT) : int16Bit; }
private static int stack_int32(CallFrame frame, int i) { Object x = frame.stack[i]; double value; if (x == UniqueTag.DOUBLE_MARK) { value = frame.sDbl[i]; } else { value = ScriptRuntime.toNumber(x); } return ScriptRuntime.toInt32(value); }
/** * * See ECMA 9.5. */ public static int toInt32(Object val) { // short circuit for common integer values if (val instanceof Integer) return ((Integer)val).intValue(); return toInt32(toNumber(val)); }
/** * * See ECMA 9.5. */ public static int toInt32(Object val) { // short circuit for common integer values if (val instanceof Integer) return ((Integer)val).intValue(); return toInt32(toNumber(val)); }
/** * * See ECMA 9.5. */ public static int toInt32(Object val) { // short circuit for common integer values if (val instanceof Integer) return ((Integer)val).intValue(); return toInt32(toNumber(val)); }
private static int stack_int32(CallFrame frame, int i) { Object x = frame.stack[i]; double value; if (x == UniqueTag.DOUBLE_MARK) { value = frame.sDbl[i]; } else { value = ScriptRuntime.toNumber(x); } return ScriptRuntime.toInt32(value); }
/** * Convert the argument to int32 number. */ public static Object toint32(Context cx, Scriptable thisObj, Object[] args, Function funObj) { Object arg = (args.length != 0 ? args[0] : Undefined.instance); if (arg instanceof Integer) return arg; return ScriptRuntime.wrapInt(ScriptRuntime.toInt32(arg)); }
/** * * See ECMA 9.5. */ public static int toInt32(Object val) { // short circuit for common integer values if (val instanceof Integer) return ((Integer)val).intValue(); return toInt32(toNumber(val)); }
/** * * See ECMA 9.5. */ public static int toInt32(Object val) { // short circuit for common integer values if (val instanceof Integer) return ((Integer)val).intValue(); return toInt32(toNumber(val)); }
public Integer[] getIndexIds() { Object[] ids = getIds(); java.util.List<Integer> indices = new java.util.ArrayList<Integer>(ids.length); for (Object id : ids) { int int32Id = ScriptRuntime.toInt32(id); if (int32Id >= 0 && ScriptRuntime.toString(int32Id).equals(ScriptRuntime.toString(id))) { indices.add(int32Id); } } return indices.toArray(new Integer[indices.size()]); }
public Integer[] getIndexIds() { Object[] ids = getIds(); java.util.List<Integer> indices = new java.util.ArrayList<Integer>(ids.length); for (Object id : ids) { int int32Id = ScriptRuntime.toInt32(id); if (int32Id >= 0 && ScriptRuntime.toString(int32Id).equals(ScriptRuntime.toString(id))) { indices.add(int32Id); } } return indices.toArray(new Integer[indices.size()]); }
public Integer[] getIndexIds() { Object[] ids = getIds(); java.util.List<Integer> indices = new java.util.ArrayList<Integer>(ids.length); for (Object id : ids) { int int32Id = ScriptRuntime.toInt32(id); if (int32Id >= 0 && ScriptRuntime.toString(int32Id).equals(ScriptRuntime.toString(id))) { indices.add(int32Id); } } return indices.toArray(new Integer[indices.size()]); }
@Override protected Object js_set(int index, Object c) { if (checkIndex(index)) { return Undefined.instance; } int val = ScriptRuntime.toInt32(c); ByteIo.writeInt32(arrayBuffer.buffer, (index * BYTES_PER_ELEMENT) + offset, val, false); return null; }