From 0678018e714901076fd3da31aa983cc6dfed3d32 Mon Sep 17 00:00:00 2001 From: Yang Rong Date: Mon, 25 Nov 2013 15:08:09 +0800 Subject: [PATCH] Refine isnan builtin. Signed-off-by: Yang Rong Reviewed-by: Zhigang Gong --- backend/src/ocl_stdlib.tmpl.h | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/backend/src/ocl_stdlib.tmpl.h b/backend/src/ocl_stdlib.tmpl.h index 555c63c..851a9aa 100644 --- a/backend/src/ocl_stdlib.tmpl.h +++ b/backend/src/ocl_stdlib.tmpl.h @@ -248,9 +248,7 @@ INLINE_OVERLOADABLE int isinf(float x) { return (u.u & 0x7FFFFFFF) == 0x7F800000; } INLINE_OVERLOADABLE int isnan(float x) { - union { uint u; float f; } u; - u.f = x; - return (u.u & 0x7FFFFFFF) > 0x7F800000; + return x != x; } INLINE_OVERLOADABLE int isnormal(float x) { union { uint u; float f; } u; -- 2.7.4