Sha256: 86b98bec9ffa3f3a0c1359d0245c02f01068eb82246cc1d3cee22f80324117ee

Contents?: true

Size: 1004 Bytes

Versions: 5646

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,646 entries across 5,629 versions & 41 rubygems

Version Path
ory-client-1.14.1 vendor/bundle/ruby/3.1.0/gems/ffi-1.17.0/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex2.inc
ory-client-1.14.0 vendor/bundle/ruby/3.1.0/gems/ffi-1.17.0/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex2.inc
affixapi-1.1.89 vendor/bundle/ruby/3.3.0/gems/ffi-1.16.3/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex2.inc
ory-hydra-client-2.2.1 vendor/bundle/ruby/3.1.0/gems/ffi-1.17.0/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex2.inc
ory-oathkeeper-client-0.40.8 vendor/bundle/ruby/3.1.0/gems/ffi-1.17.0/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex2.inc
ory-client-1.13.10 vendor/bundle/ruby/3.1.0/gems/ffi-1.17.0/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex2.inc
ory-client-1.13.6 vendor/bundle/ruby/3.1.0/gems/ffi-1.17.0/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex2.inc
ory-client-1.13.4 vendor/bundle/ruby/3.1.0/gems/ffi-1.17.0/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex2.inc
ory-client-1.13.3 vendor/bundle/ruby/3.1.0/gems/ffi-1.17.0/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex2.inc
ory-client-1.13.2 vendor/bundle/ruby/3.1.0/gems/ffi-1.17.0/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex2.inc
ory-client-1.13.1 vendor/bundle/ruby/3.1.0/gems/ffi-1.17.0/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex2.inc
ory-client-1.13.0 vendor/bundle/ruby/3.1.0/gems/ffi-1.17.0/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex2.inc
mux_ruby-3.17.0 vendor/bundle/ruby/3.2.0/gems/ffi-1.16.3/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex2.inc
affixapi-1.1.88 vendor/bundle/ruby/3.3.0/gems/ffi-1.16.3/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex2.inc
affixapi-1.1.87 vendor/bundle/ruby/3.3.0/gems/ffi-1.16.3/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex2.inc
affixapi-1.1.86 vendor/bundle/ruby/3.3.0/gems/ffi-1.16.3/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex2.inc
affixapi-1.1.85 vendor/bundle/ruby/3.3.0/gems/ffi-1.16.3/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex2.inc
affixapi-1.1.84 vendor/bundle/ruby/3.3.0/gems/ffi-1.16.3/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex2.inc
ffi-1.17.0 ext/ffi_c/libffi/testsuite/libffi.complex/return_complex2.inc
cybrid_api_id_ruby-0.117.27 vendor/bundle/ruby/3.2.0/gems/ffi-1.16.3/ext/ffi_c/libffi/testsuite/libffi.complex/return_complex2.inc