Ejemplo n.º 1
0
 @Test
 public void testPassFloats() {
   Pointer<Byte> out = allocateBytes(8);
   for (int value : intValues) {
     passVarArgs(out, false, (float) value);
     assertEquals(value, out.getDouble(), 0);
   }
 }
Ejemplo n.º 2
0
  @Override
  public void fromNative(Runtime runtime, Pointer memory, long offset) {
    switch (runtime.findType(typeAlias).getNativeType()) {
      case SCHAR:
      case UCHAR:
        value = memory.getByte(offset);
        break;

      case SSHORT:
      case USHORT:
        value = memory.getShort(offset);
        break;

      case SINT:
      case UINT:
        value = memory.getInt(offset);
        break;

      case SLONG:
      case ULONG:
        value = memory.getLong(offset);
        break;

      case SLONGLONG:
      case ULONGLONG:
        value = memory.getLongLong(offset);
        break;

      case ADDRESS:
        value = memory.getAddress(offset);
        break;

      case FLOAT:
        value = memory.getFloat(offset);
        break;

      case DOUBLE:
        value = memory.getDouble(offset);
        break;

      default:
        throw new UnsupportedOperationException("unsupported type: " + typeAlias);
    }
  }