66//
77//===----------------------------------------------------------------------===//
88
9+ #include <clc/clc_as_type.h>
910#include <clc/float/definitions.h>
1011#include <clc/opencl/opencl-base.h>
1112
@@ -53,7 +54,7 @@ _CLC_DEF _CLC_OVERLOAD float __clc_rtz(float x) {
5354 if (fabs (x ) > 65504.0f && !isinf (x ))
5455 return copysign (65504.0f , x );
5556
56- const int exp = (as_uint (x ) >> 23 & 0xff ) - 127 ;
57+ const int exp = (__clc_as_uint (x ) >> 23 & 0xff ) - 127 ;
5758 /* Manage range rounded to +- zero explicitely */
5859 if (exp < -24 )
5960 return copysign (0.0f , x );
@@ -64,7 +65,7 @@ _CLC_DEF _CLC_OVERLOAD float __clc_rtz(float x) {
6465 if (exp < -14 )
6566 mask <<= min (- (exp + 14 ), 10 );
6667
67- return as_float ( as_uint (x ) & mask );
68+ return __clc_as_float ( __clc_as_uint (x ) & mask );
6869}
6970
7071_CLC_DEF _CLC_OVERLOAD float __clc_rti (float x ) {
@@ -73,18 +74,18 @@ _CLC_DEF _CLC_OVERLOAD float __clc_rti(float x) {
7374 return x ;
7475
7576 const float inf = copysign (INFINITY , x );
76- uint ux = as_uint (x );
77+ uint ux = __clc_as_uint (x );
7778
7879 /* Manage +- infinity explicitely */
79- if (as_float (ux & 0x7fffffff ) > 0x1.ffcp+15f ) {
80+ if (__clc_as_float (ux & 0x7fffffff ) > 0x1.ffcp+15f ) {
8081 return inf ;
8182 }
8283 /* Manage +- zero explicitely */
8384 if ((ux & 0x7fffffff ) == 0 ) {
8485 return copysign (0.0f , x );
8586 }
8687
87- const int exp = (as_uint (x ) >> 23 & 0xff ) - 127 ;
88+ const int exp = (__clc_as_uint (x ) >> 23 & 0xff ) - 127 ;
8889 /* Manage range rounded to smallest half denormal explicitely */
8990 if (exp < -24 ) {
9091 return copysign (0x1.0p-24f , x );
@@ -97,19 +98,19 @@ _CLC_DEF _CLC_OVERLOAD float __clc_rti(float x) {
9798 mask = (1 << (13 + min (- (exp + 14 ), 10 ))) - 1 ;
9899 }
99100
100- const float next = nextafter (as_float (ux | mask ), inf );
101- return ((ux & mask ) == 0 ) ? as_float (ux ) : next ;
101+ const float next = nextafter (__clc_as_float (ux | mask ), inf );
102+ return ((ux & mask ) == 0 ) ? __clc_as_float (ux ) : next ;
102103}
103104_CLC_DEF _CLC_OVERLOAD float __clc_rtn (float x ) {
104- return ((as_uint (x ) & 0x80000000 ) == 0 ) ? __clc_rtz (x ) : __clc_rti (x );
105+ return ((__clc_as_uint (x ) & 0x80000000 ) == 0 ) ? __clc_rtz (x ) : __clc_rti (x );
105106}
106107_CLC_DEF _CLC_OVERLOAD float __clc_rtp (float x ) {
107- return ((as_uint (x ) & 0x80000000 ) == 0 ) ? __clc_rti (x ) : __clc_rtz (x );
108+ return ((__clc_as_uint (x ) & 0x80000000 ) == 0 ) ? __clc_rti (x ) : __clc_rtz (x );
108109}
109110_CLC_DEF _CLC_OVERLOAD float __clc_rte (float x ) {
110111 /* Mantisa + implicit bit */
111- const uint mantissa = (as_uint (x ) & 0x7fffff ) | (1u << 23 );
112- const int exp = (as_uint (x ) >> 23 & 0xff ) - 127 ;
112+ const uint mantissa = (__clc_as_uint (x ) & 0x7fffff ) | (1u << 23 );
113+ const int exp = (__clc_as_uint (x ) >> 23 & 0xff ) - 127 ;
113114 int shift = 13 ;
114115 if (exp < -14 ) {
115116 /* The default assumes lower 13 bits are rounded,
0 commit comments