Signed-off-by: Homer Hsing <[email protected]>
---
backend/src/ocl_stdlib.tmpl.h | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/backend/src/ocl_stdlib.tmpl.h b/backend/src/ocl_stdlib.tmpl.h
index 2b470e5..72f7d76 100644
--- a/backend/src/ocl_stdlib.tmpl.h
+++ b/backend/src/ocl_stdlib.tmpl.h
@@ -318,12 +318,12 @@ INLINE_OVERLOADABLE uint clz(uint x) {
}
INLINE_OVERLOADABLE long clz(long x) {
- if (x < 0)
- return 0;
- if (x == 0)
- return 64;
union { int i[2]; long x; } u;
u.x = x;
+ if (u.i[1] & 0x80000000u)
+ return 0;
+ if (u.i[1] == 0 && u.i[0] == 0)
+ return 64;
uint v = clz(u.i[1]);
if(v == 32)
v += clz(u.i[0]);
--
1.8.1.2
_______________________________________________
Beignet mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/beignet