[Beignet] [PATCH 2/2] Refine isnan builtin.

Yang Rong rong.r.yang at intel.com
Sun Nov 24 23:08:09 PST 2013


Signed-off-by: Yang Rong <rong.r.yang at intel.com>
---
 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 e5a6da5..2a16c0d 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;
-- 
1.8.1.2



More information about the Beignet mailing list