POSIX: add CMPLX(), CMPLXF(), CMPLXL()
appeared in issue 8: https://pubs.opengroup.org/onlinepubs/9799919799/functions/CMPLX.html Change-Id: I037e7368611e201df28589172f926e7a9fc52be2 Reviewed-on: https://review.haiku-os.org/c/haiku/+/9758 Reviewed-by: Jérôme Duval <[email protected]> Tested-by: Commit checker robot <[email protected]>
This commit is contained in:
+11
-1
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2015 Haiku, Inc. All Rights Reserved.
|
* Copyright 2015, 2025 Haiku, Inc. All Rights Reserved.
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*/
|
*/
|
||||||
#ifndef _COMPLEX_H_
|
#ifndef _COMPLEX_H_
|
||||||
@@ -15,6 +15,16 @@
|
|||||||
#define complex _Complex
|
#define complex _Complex
|
||||||
#define I _Complex_I
|
#define I _Complex_I
|
||||||
|
|
||||||
|
#ifdef _Imaginary_I
|
||||||
|
#define CMPLX(x, y) ((double complex)((double)(x) + _Imaginary_I * (double)(y)))
|
||||||
|
#define CMPLXF(x, y) ((float complex)((float)(x) + _Imaginary_I * (float)(y)))
|
||||||
|
#define CMPLXL(x, y) ((long double complex)((long double)(x) + _Imaginary_I * (long double)(y)))
|
||||||
|
#else
|
||||||
|
#define CMPLX(x, y) (__builtin_complex((double)(x), (double)(y)))
|
||||||
|
#define CMPLXF(x, y) (__builtin_complex((float)(x), (float)(y)))
|
||||||
|
#define CMPLXL(x, y) (__builtin_complex((long double)(x), (long double)(y)))
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user