2 #include
<clc
/clcmacro.h
>
4 _CLC_DEFINE_BINARY_BUILTIN
(float, copysign
, __builtin_copysignf
, float
, float
)
8 #pragma OPENCL EXTENSION cl_khr_fp64
: enable
10 _CLC_DEFINE_BINARY_BUILTIN
(double, copysign
, __builtin_copysign
, double
, double
)
16 #pragma OPENCL EXTENSION cl_khr_fp16
: enable
18 _CLC_DEF _CLC_OVERLOAD half copysign
(half x
, half y
)
20 ushort sign_x
= as_ushort
(x) & 0x8000u
;
21 ushort unsigned_y
= as_ushort
(y) & 0x7ffffu
;
23 return as_half
((ushort)(sign_x | unsigned_y
));
25 _CLC_BINARY_VECTORIZE
(_CLC_OVERLOAD _CLC_DEF
, half
, copysign
, half
, half
)