diff options
author | Mikhail Borisov <borisov.mikhail@gmail.com> | 2022-02-10 16:45:40 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:45:40 +0300 |
commit | 5d50718e66d9c037dc587a0211110b7d25a66185 (patch) | |
tree | e98df59de24d2ef7c77baed9f41e4875a2fef972 /contrib/restricted/libffi/testsuite/libffi.complex/complex.inc | |
parent | a6a92afe03e02795227d2641b49819b687f088f8 (diff) | |
download | ydb-5d50718e66d9c037dc587a0211110b7d25a66185.tar.gz |
Restoring authorship annotation for Mikhail Borisov <borisov.mikhail@gmail.com>. Commit 2 of 2.
Diffstat (limited to 'contrib/restricted/libffi/testsuite/libffi.complex/complex.inc')
-rw-r--r-- | contrib/restricted/libffi/testsuite/libffi.complex/complex.inc | 102 |
1 files changed, 51 insertions, 51 deletions
diff --git a/contrib/restricted/libffi/testsuite/libffi.complex/complex.inc b/contrib/restricted/libffi/testsuite/libffi.complex/complex.inc index 61c0994a19..515ae3e60d 100644 --- a/contrib/restricted/libffi/testsuite/libffi.complex/complex.inc +++ b/contrib/restricted/libffi/testsuite/libffi.complex/complex.inc @@ -1,51 +1,51 @@ -/* -*-c-*-*/ -#include "ffitest.h" -#include <complex.h> - -static _Complex T_C_TYPE f_complex(_Complex T_C_TYPE c, int x, int *py) -{ - c = -(2 * creal (c)) + (cimag (c) + 1)* I; - *py += x; - - return c; -} - -int main (void) -{ - ffi_cif cif; - ffi_type *args[MAX_ARGS]; - void *values[MAX_ARGS]; - - _Complex T_C_TYPE tc_arg; - _Complex T_C_TYPE tc_result; - int tc_int_arg_x; - int tc_y; - int *tc_ptr_arg_y = &tc_y; - - args[0] = &T_FFI_TYPE; - args[1] = &ffi_type_sint; - args[2] = &ffi_type_pointer; - values[0] = &tc_arg; - values[1] = &tc_int_arg_x; - values[2] = &tc_ptr_arg_y; - - /* Initialize the cif */ - CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 3, - &T_FFI_TYPE, args) == FFI_OK); - - tc_arg = 1 + 7 * I; - tc_int_arg_x = 1234; - tc_y = 9876; - ffi_call(&cif, FFI_FN(f_complex), &tc_result, values); - - printf ("%f,%fi %f,%fi, x %d 1234, y %d 11110\n", - T_CONV creal (tc_result), T_CONV cimag (tc_result), - T_CONV creal (2.0), T_CONV creal (8.0), tc_int_arg_x, tc_y); - - CHECK (creal (tc_result) == -2); - CHECK (cimag (tc_result) == 8); - CHECK (tc_int_arg_x == 1234); - CHECK (*tc_ptr_arg_y == 11110); - - exit(0); -} +/* -*-c-*-*/ +#include "ffitest.h" +#include <complex.h> + +static _Complex T_C_TYPE f_complex(_Complex T_C_TYPE c, int x, int *py) +{ + c = -(2 * creal (c)) + (cimag (c) + 1)* I; + *py += x; + + return c; +} + +int main (void) +{ + ffi_cif cif; + ffi_type *args[MAX_ARGS]; + void *values[MAX_ARGS]; + + _Complex T_C_TYPE tc_arg; + _Complex T_C_TYPE tc_result; + int tc_int_arg_x; + int tc_y; + int *tc_ptr_arg_y = &tc_y; + + args[0] = &T_FFI_TYPE; + args[1] = &ffi_type_sint; + args[2] = &ffi_type_pointer; + values[0] = &tc_arg; + values[1] = &tc_int_arg_x; + values[2] = &tc_ptr_arg_y; + + /* Initialize the cif */ + CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 3, + &T_FFI_TYPE, args) == FFI_OK); + + tc_arg = 1 + 7 * I; + tc_int_arg_x = 1234; + tc_y = 9876; + ffi_call(&cif, FFI_FN(f_complex), &tc_result, values); + + printf ("%f,%fi %f,%fi, x %d 1234, y %d 11110\n", + T_CONV creal (tc_result), T_CONV cimag (tc_result), + T_CONV creal (2.0), T_CONV creal (8.0), tc_int_arg_x, tc_y); + + CHECK (creal (tc_result) == -2); + CHECK (cimag (tc_result) == 8); + CHECK (tc_int_arg_x == 1234); + CHECK (*tc_ptr_arg_y == 11110); + + exit(0); +} |