29#if defined(_M_IX86) && defined(__VS_PROJECT__) && (_MSC_FULL_VER < 194133923)
34#define ULONG_OVERFLOW ULONG_MAX
35#define ULONGLONG_OVERFLOW ULLONG_MAX
37#define ULONG_OVERFLOW 0ul
38#define ULONGLONG_OVERFLOW 0x8000000000000000ull
42#define todo_gcc todo_ros
48long cast_float_to_long(
float f)
54unsigned long cast_float_to_ulong(
float f)
56 return (
unsigned long)
f;
60long cast_double_to_long(
double d)
66unsigned long cast_double_to_ulong(
double d)
68 return (
unsigned long)
d;
72long long cast_float_to_longlong(
float f)
78unsigned long long cast_float_to_ulonglong(
float f)
80 return (
unsigned long long)
f;
84long long cast_double_to_longlong(
double d)
90unsigned long long cast_double_to_ulonglong(
double d)
92 return (
unsigned long long)
d;
105 ok_eq_long(cast_float_to_long(2147483500.0f), 2147483520l);
106 ok_eq_long(cast_float_to_long(2147483583.999f), 2147483520l);
107 ok_eq_long(cast_float_to_long(-2147483583.999f), -2147483520l);
119 ok_eq_ulong(cast_float_to_ulong(2147483648.0f), 2147483648ul);
120 ok_eq_ulong(cast_float_to_ulong(4294967150.0f), 4294967040ul);
132 ok_eq_ulong(cast_float_to_ulong(-10.0f), (
unsigned long)-10);
133 ok_eq_ulong(cast_float_to_ulong(-1147483648.0f), (
unsigned long)-1147483648ll);
134 ok_eq_ulong(cast_float_to_ulong(-2147483648.0f), (
unsigned long)-2147483648ll);
145 ok_eq_longlong(cast_float_to_longlong(9223371761976868863.9999f), 9223371487098961920ll);
147 ok_eq_longlong(cast_float_to_longlong(-9223371761976868863.9999f), -9223371487098961920ll);
157 ok_eq_ulonglong(cast_float_to_ulonglong(9223371487098961920.0f), 9223371487098961920ull);
158 ok_eq_ulonglong(cast_float_to_ulonglong(9223372036854775808.0f), 9223372036854775808ull);
159 ok_eq_ulonglong(cast_float_to_ulonglong(18446743523953737727.9f), 18446742974197923840ull);
166 ok_eq_ulonglong(cast_float_to_ulonglong(-1.0f), 18446744073709551615ull);
175 ok_eq_ulonglong(cast_float_to_ulonglong(-10.0f), (
unsigned long long)-10);
176 ok_eq_ulonglong(cast_float_to_ulonglong(-1147483648.0f), (
unsigned long long)-1147483648ll);
177 ok_eq_ulonglong(cast_float_to_ulonglong(-2147483648.0f), (
unsigned long long)-2147483648ll);
178 ok_eq_ulonglong(cast_float_to_ulonglong(-9223371761976868863.9f), (
unsigned long long)-9223371487098961920);
179 ok_eq_ulonglong(cast_float_to_ulonglong(-9223371761976868864.0f), (
unsigned long long)(-9223372036854775807ll - 1));
180 ok_eq_ulonglong(cast_float_to_ulonglong(-9223372036854775808.0f), (
unsigned long long)(-9223372036854775807ll - 1));
195 ok_eq_long(cast_double_to_long(2147483647.99999), 2147483647l);
196 ok_eq_long(cast_double_to_long(-2147483647.99999), -2147483647l);
206 ok_eq_ulong(cast_double_to_ulong(0.999999999), 0ul);
207 ok_eq_ulong(cast_double_to_ulong(2147483648.0), 2147483648ul);
208 ok_eq_ulong(cast_double_to_ulong(4294967295.0), 4294967295ul);
220 ok_eq_ulong(cast_double_to_ulong(-10.0), (
unsigned long)-10);
221 ok_eq_ulong(cast_double_to_ulong(-1147483648.0), (
unsigned long)-1147483648ll);
222 ok_eq_ulong(cast_double_to_ulong(-2147483648.0), (
unsigned long)-2147483648ll);
233 ok_eq_longlong(cast_double_to_longlong(9223372036854775295.9), 9223372036854774784ll);
235 ok_eq_longlong(cast_double_to_longlong(-9223372036854775295.9), -9223372036854774784ll);
245 ok_eq_ulonglong(cast_double_to_ulonglong(9223372036854774784.0), 9223372036854774784ull);
246 ok_eq_ulonglong(cast_double_to_ulonglong(9223372036854775808.0), 9223372036854775808ull);
247 ok_eq_ulonglong(cast_double_to_ulonglong(18446744073709550591.9), 18446744073709549568ull);
255 ok_eq_ulonglong(cast_double_to_ulonglong(-1.0), 18446744073709551615ull);
264 ok_eq_ulonglong(cast_double_to_ulonglong(-10.0), (
unsigned long long)-10);
265 ok_eq_ulonglong(cast_double_to_ulonglong(-1147483648.0), (
unsigned long long)-1147483648ll);
266 ok_eq_ulonglong(cast_double_to_ulonglong(-2147483648.0), (
unsigned long long)-2147483648ll);
267 ok_eq_ulonglong(cast_double_to_ulonglong(-9223372036854775000.0), (
unsigned long long)-9223372036854774784ll);
268 ok_eq_ulonglong(cast_double_to_ulonglong(-9223372036854775808.0), (
unsigned long long)(-9223372036854775807ll - 1));
#define ok_eq_ulong(value, expected)
#define ok_eq_longlong(value, expected)
#define ok_eq_long(value, expected)
#define ok_eq_ulonglong(value, expected)
#define ULONGLONG_OVERFLOW