Sha256: 86b98bec9ffa3f3a0c1359d0245c02f01068eb82246cc1d3cee22f80324117ee

Contents?: true

Size: 1004 Bytes

Versions: 5649

Compression:

Stored size: 1004 Bytes

Contents

/* -*-c-*- */
#include "ffitest.h"
#include <complex.h>

_Complex T_C_TYPE
return_c(_Complex T_C_TYPE c1, _Complex T_C_TYPE c2,
	 unsigned int in3, _Complex T_C_TYPE c4)
{
  volatile _Complex T_C_TYPE r = c1 + c2 + in3 + c4;
  return r;
}

int main (void)
{
  ffi_cif cif;
  ffi_type *args[MAX_ARGS];
  void *values[MAX_ARGS];
  _Complex T_C_TYPE c1, c2, c4, rc, rc2;
  unsigned int in3;
  args[0] = &T_FFI_TYPE;
  args[1] = &T_FFI_TYPE;
  args[2] = &ffi_type_uint;
  args[3] = &T_FFI_TYPE;
  values[0] = &c1;
  values[1] = &c2;
  values[2] = &in3;
  values[3] = &c4;

  /* Initialize the cif */
  CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 4,
		     &T_FFI_TYPE, args) == FFI_OK);
  c1 = 127.0 + 255.0 * I;
  c2 = 128.0 + 256.0;
  in3 = 255;
  c4 = 512.7 + 1024.1 * I;

  ffi_call(&cif, FFI_FN(return_c), &rc, values);
  rc2 = return_c(c1, c2, in3, c4);
  printf ("%f,%fi vs %f,%fi\n",
	  T_CONV creal (rc), T_CONV cimag (rc),
	  T_CONV creal (rc2), T_CONV cimag (rc2));
  CHECK(rc == rc2);
  exit(0);
}

Version data entries

5,649 entries across 5,631 versions & 42 rubygems

Version Path
vagrant-unbundled-2.2.5.0 vendor/bundle/ruby/2.5.0/gems/ffi-1.10.0/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex2.inc
vagrant-unbundled-2.2.5.0 vendor/bundle/ruby/2.6.0/gems/ffi-1.10.0/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex2.inc
zuora_connect_ui-0.8.2 vendor/ruby/2.6.0/gems/ffi-1.11.1/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex2.inc
zuora_connect_ui-0.8.1 vendor/ruby/2.6.0/gems/ffi-1.11.1/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex2.inc
zuora_connect_ui-0.8.0 vendor/ruby/2.6.0/gems/ffi-1.11.1/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex2.inc
dadapush_client-1.0.1 vendor/bundle/ruby/2.3.0/gems/ffi-1.9.25/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex2.inc
zuora_connect_ui-0.7.1 vendor/ruby/2.6.0/gems/ffi-1.11.1/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex2.inc
zuora_connect_ui-0.7.0 vendor/ruby/2.6.0/gems/ffi-1.11.1/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex2.inc
ffi-1.11.1 ext/ffi_c/libffi/testsuite/libffi.complex/return_complex2.inc
tdiary-5.0.13 vendor/bundle/gems/ffi-1.10.0/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex2.inc
approveapi-1.0.8 vendor/bundle/ruby/2.6.0/gems/ffi-1.10.0/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex2.inc
tdiary-5.0.12.1 vendor/bundle/gems/ffi-1.10.0/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex2.inc
vagrant-unbundled-2.2.4.0 vendor/bundle/ruby/2.6.0/gems/ffi-1.10.0/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex2.inc
vagrant-unbundled-2.2.4.0 vendor/bundle/ruby/2.5.0/gems/ffi-1.10.0/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex2.inc
vagrant-unbundled-2.2.4.0 vendor/bundle/ruby/2.5.0/gems/ffi-1.9.25/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex2.inc
approveapi-1.0.5 vendor/bundle/ruby/2.6.0/gems/ffi-1.10.0/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex2.inc
alimentos-alu0100945645-0.1.0 vendor/bundle/ruby/2.3.0/gems/ffi-1.9.25/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex2.inc
alimentos-alu0100945645-1.0.0 vendor/bundle/ruby/2.3.0/gems/ffi-1.9.25/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex2.inc
vagrant-unbundled-2.2.3.0 vendor/bundle/ruby/2.5.0/gems/ffi-1.9.25/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex2.inc
vagrant-unbundled-2.2.3.0 vendor/bundle/ruby/2.5.0/gems/ffi-1.10.0/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex2.inc