[Beignet] [PATCH] fix builtin function "isnormal"

Yang, Rong R rong.r.yang at intel.com
Thu Nov 14 00:41:21 PST 2013


LGTM, thanks.

-----Original Message-----
From: beignet-bounces+rong.r.yang=intel.com at lists.freedesktop.org [mailto:beignet-bounces+rong.r.yang=intel.com at lists.freedesktop.org] On Behalf Of Homer Hsing
Sent: Friday, November 08, 2013 1:28 PM
To: beignet at lists.freedesktop.org
Subject: [Beignet] [PATCH] fix builtin function "isnormal"

fix a corner case of very small input

Signed-off-by: Homer Hsing <homer.xing at intel.com>
---
 backend/src/ocl_stdlib.tmpl.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/backend/src/ocl_stdlib.tmpl.h b/backend/src/ocl_stdlib.tmpl.h index ec9ed60..fc4ea3c 100644
--- a/backend/src/ocl_stdlib.tmpl.h
+++ b/backend/src/ocl_stdlib.tmpl.h
@@ -256,7 +256,7 @@ INLINE_OVERLOADABLE int isnormal(float x) {
   union { uint u; float f; } u;
   u.f = x;
   u.u &= 0x7FFFFFFF;
-  return (u.u < 0x7F800000) && (u.u >= 1);
+  return (u.u < 0x7F800000) && (u.u >= 0x800000);
 }
 INLINE_OVERLOADABLE int isordered(float x, float y) { return isequal(x, x) && isequal(y, y); }  INLINE_OVERLOADABLE int isunordered(float x, float y) { return isnan(x) || isnan(y); }
--
1.8.3.2

_______________________________________________
Beignet mailing list
Beignet at lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/beignet


More information about the Beignet mailing list