Exemplo n.º 1
0
  @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);
    }
  }
Exemplo n.º 2
0
 @Override
 public void putAddress(long offset, Address value) {
   checkBounds(size, offset, getRuntime().addressSize());
   io.putAddress(base + offset, value);
 }