@@ -200,21 +200,21 @@ rotr64(uint64 n, uint64 c)
200200static inline float32
201201f32_min (float32 a , float32 b )
202202{
203- if (isnan (a ) || isnan (b ))
203+ if (isnanf (a ) || isnanf (b ))
204204 return NAN ;
205205 else if (a == 0 && a == b )
206- return signbit (a ) ? a : b ;
206+ return signbitf (a ) ? a : b ;
207207 else
208208 return a > b ? b : a ;
209209}
210210
211211static inline float32
212212f32_max (float32 a , float32 b )
213213{
214- if (isnan (a ) || isnan (b ))
214+ if (isnanf (a ) || isnanf (b ))
215215 return NAN ;
216216 else if (a == 0 && a == b )
217- return signbit (a ) ? b : a ;
217+ return signbitf (a ) ? b : a ;
218218 else
219219 return a > b ? a : b ;
220220}
@@ -861,31 +861,31 @@ wasm_interp_get_frame_ref(WASMInterpFrame *frame)
861861 PUSH_##src_op_type(method(src_val)); \
862862 } while (0)
863863
864- #define TRUNC_FUNCTION (func_name , src_type , dst_type , signed_type ) \
865- static dst_type func_name(src_type src_value, src_type src_min, \
866- src_type src_max, dst_type dst_min, \
867- dst_type dst_max, bool is_sign) \
868- { \
869- dst_type dst_value = 0; \
870- if (!isnan (src_value)) { \
871- if (src_value <= src_min) \
872- dst_value = dst_min; \
873- else if (src_value >= src_max) \
874- dst_value = dst_max; \
875- else { \
876- if (is_sign) \
877- dst_value = (dst_type)(signed_type)src_value; \
878- else \
879- dst_value = (dst_type)src_value; \
880- } \
881- } \
882- return dst_value; \
864+ #define TRUNC_FUNCTION (func_name , src_type , dst_type , signed_type , isnan_op ) \
865+ static dst_type func_name(src_type src_value, src_type src_min, \
866+ src_type src_max, dst_type dst_min, \
867+ dst_type dst_max, bool is_sign) \
868+ { \
869+ dst_type dst_value = 0; \
870+ if (!isnan_op (src_value)) { \
871+ if (src_value <= src_min) \
872+ dst_value = dst_min; \
873+ else if (src_value >= src_max) \
874+ dst_value = dst_max; \
875+ else { \
876+ if (is_sign) \
877+ dst_value = (dst_type)(signed_type)src_value; \
878+ else \
879+ dst_value = (dst_type)src_value; \
880+ } \
881+ } \
882+ return dst_value; \
883883 }
884884
885- TRUNC_FUNCTION (trunc_f32_to_i32 , float32 , uint32 , int32 )
886- TRUNC_FUNCTION (trunc_f32_to_i64 , float32 , uint64 , int64 )
887- TRUNC_FUNCTION (trunc_f64_to_i32 , float64 , uint32 , int32 )
888- TRUNC_FUNCTION (trunc_f64_to_i64 , float64 , uint64 , int64 )
885+ TRUNC_FUNCTION (trunc_f32_to_i32 , float32 , uint32 , int32 , isnanf )
886+ TRUNC_FUNCTION (trunc_f32_to_i64 , float32 , uint64 , int64 , isnanf )
887+ TRUNC_FUNCTION (trunc_f64_to_i32 , float64 , uint32 , int32 , isnan )
888+ TRUNC_FUNCTION (trunc_f64_to_i64 , float64 , uint64 , int64 , isnan )
889889
890890static bool
891891trunc_f32_to_int (WASMModuleInstance * module , uint32 * frame_sp , float32 src_min ,
@@ -896,7 +896,7 @@ trunc_f32_to_int(WASMModuleInstance *module, uint32 *frame_sp, float32 src_min,
896896 uint32 dst_value_i32 ;
897897
898898 if (!saturating ) {
899- if (isnan (src_value )) {
899+ if (isnanf (src_value )) {
900900 wasm_set_exception (module , "invalid conversion to integer" );
901901 return false;
902902 }
0 commit comments