@Override public void toNative(Runtime runtime, Pointer memory, long offset) { switch (runtime.findType(typeAlias).getNativeType()) { case SCHAR: case UCHAR: memory.putByte(offset, value.byteValue()); break; case SSHORT: case USHORT: memory.putShort(offset, value.shortValue()); break; case SINT: case UINT: memory.putInt(offset, value.intValue()); break; case SLONG: case ULONG: memory.putLong(offset, value.longValue()); break; case SLONGLONG: case ULONGLONG: memory.putLongLong(offset, value.longValue()); break; case ADDRESS: memory.putAddress(offset, value.longValue()); break; case FLOAT: memory.putFloat(offset, value.floatValue()); break; case DOUBLE: memory.putDouble(offset, value.doubleValue()); break; default: throw new UnsupportedOperationException("unsupported type: " + typeAlias); } }
@Override public void putFloat(long offset, float value) { checkBounds(size, offset, 4); io.putFloat(base + offset, value); }