public int size() { return type.size(); }
public int sizeOf(NativeType type) { return getType(type).size(); }
private static int encode(HeapInvocationBuffer.Encoder encoder, byte[] paramBuffer, int off, Type type, long n) { if (type.size() <= 4) { return encoder.putInt(paramBuffer, off, (int) n); } else { return encoder.putLong(paramBuffer, off, n); } }
/** * Invokes a function that returns a C struct by value. * * @param ctx The call context which describes how to call the native function. * @param function The address of the native function to invoke. * @param buffer The parameter buffer. * @return A byte array with the return value encoded in native byte order. */ public final byte[] invokeStruct(CallContext ctx, long function, HeapInvocationBuffer buffer) { byte[] returnBuffer = new byte[ctx.getReturnType().size()]; invokeStruct(ctx, function, buffer, returnBuffer, 0); return returnBuffer; }
private static int encode(HeapInvocationBuffer.Encoder encoder, byte[] paramBuffer, int off, Type type, long n) { if (type.size() <= 4) { return encoder.putInt(paramBuffer, off, (int) n); } else { return encoder.putLong(paramBuffer, off, n); } }
private static int encode(HeapInvocationBuffer.Encoder encoder, byte[] paramBuffer, int off, Type type, long n) { if (type.size() <= 4) { return encoder.putInt(paramBuffer, off, (int) n); } else { return encoder.putLong(paramBuffer, off, n); } }
public final void putLongDouble(final BigDecimal value) { byte[] ld = new byte[Type.LONGDOUBLE.size()]; Foreign.getInstance().longDoubleFromString(value.toEngineeringString(), ld, 0, Type.LONGDOUBLE.size()); getObjectBuffer().putArray(paramIndex, ld, 0, ld.length, ObjectBuffer.IN); paramOffset += PARAM_SIZE; ++paramIndex; }
public final void putLongDouble(final BigDecimal value) { byte[] ld = new byte[Type.LONGDOUBLE.size()]; Foreign.getInstance().longDoubleFromString(value.toEngineeringString(), ld, 0, Type.LONGDOUBLE.size()); getObjectBuffer().putArray(paramIndex, ld, 0, ld.length, ObjectBuffer.IN); paramOffset += PARAM_SIZE; ++paramIndex; }
public final void putLongDouble(final BigDecimal value) { byte[] ld = new byte[Type.LONGDOUBLE.size()]; Foreign.getInstance().longDoubleFromString(value.toEngineeringString(), ld, 0, Type.LONGDOUBLE.size()); getObjectBuffer().putArray(paramIndex, ld, 0, ld.length, ObjectBuffer.IN); paramOffset += PARAM_SIZE; ++paramIndex; }
public final void putStruct(final byte[] struct, int offset) { final Type type = callContext.getParameterType(paramIndex); paramOffset = Encoder.getInstance().skipAddress(paramOffset); getObjectBuffer().putArray(paramIndex, struct, offset, type.size(), ObjectBuffer.IN); ++paramIndex; }
public final void putStruct(final byte[] struct, int offset) { final Type type = callContext.getParameterType(paramIndex); paramOffset = Encoder.getInstance().skipAddress(paramOffset); getObjectBuffer().putArray(paramIndex, struct, offset, type.size(), ObjectBuffer.IN); ++paramIndex; }
public final void putStruct(final byte[] struct, int offset) { final Type type = callContext.getParameterType(paramIndex); paramOffset = Encoder.getInstance().skipAddress(paramOffset); getObjectBuffer().putArray(paramIndex, struct, offset, type.size(), ObjectBuffer.IN); ++paramIndex; }
private long invokeO1(Function function, byte[] paramBuffer, Object o1, int o1off, int o1len, ObjectParameterInfo o1flags) { return function.getReturnType().size() == 8 ? foreign.invokeArrayO1Int64(function.getContextAddress(), function.getFunctionAddress(), paramBuffer, o1, o1flags.asObjectInfo(), o1off, o1len) : foreign.invokeArrayO1Int32(function.getContextAddress(), function.getFunctionAddress(), paramBuffer, o1, o1flags.asObjectInfo(), o1off, o1len); }
private long invokeO1(Function function, byte[] paramBuffer, Object o1, int o1off, int o1len, ObjectParameterInfo o1flags) { return function.getReturnType().size() == 8 ? foreign.invokeArrayO1Int64(function.getContextAddress(), function.getFunctionAddress(), paramBuffer, o1, o1flags.asObjectInfo(), o1off, o1len) : foreign.invokeArrayO1Int32(function.getContextAddress(), function.getFunctionAddress(), paramBuffer, o1, o1flags.asObjectInfo(), o1off, o1len); }
private long invokeO1(Function function, byte[] paramBuffer, Object o1, int o1off, int o1len, ObjectParameterInfo o1flags) { return function.getReturnType().size() == 8 ? foreign.invokeArrayO1Int64(function.getContextAddress(), function.getFunctionAddress(), paramBuffer, o1, o1flags.asObjectInfo(), o1off, o1len) : foreign.invokeArrayO1Int32(function.getContextAddress(), function.getFunctionAddress(), paramBuffer, o1, o1flags.asObjectInfo(), o1off, o1len); }
private long invokeO2(Function function, byte[] paramBuffer, Object o1, int o1off, int o1len, ObjectParameterInfo o1flags, Object o2, int o2off, int o2len, ObjectParameterInfo o2flags) { return function.getReturnType().size() == 8 ? foreign.invokeArrayO2Int64(function.getContextAddress(), function.getFunctionAddress(), paramBuffer, o1, o1flags.asObjectInfo(), o1off, o1len, o2, o2flags.asObjectInfo(), o2off, o2len) : foreign.invokeArrayO2Int32(function.getContextAddress(), function.getFunctionAddress(), paramBuffer, o1, o1flags.asObjectInfo(), o1off, o1len, o2, o2flags.asObjectInfo(), o2off, o2len); }
private long invokeO2(Function function, byte[] paramBuffer, Object o1, int o1off, int o1len, ObjectParameterInfo o1flags, Object o2, int o2off, int o2len, ObjectParameterInfo o2flags) { return function.getReturnType().size() == 8 ? foreign.invokeArrayO2Int64(function.getContextAddress(), function.getFunctionAddress(), paramBuffer, o1, o1flags.asObjectInfo(), o1off, o1len, o2, o2flags.asObjectInfo(), o2off, o2len) : foreign.invokeArrayO2Int32(function.getContextAddress(), function.getFunctionAddress(), paramBuffer, o1, o1flags.asObjectInfo(), o1off, o1len, o2, o2flags.asObjectInfo(), o2off, o2len); }