[Beignet] [PATCH 2/2] toMB: use standard constant

Giuseppe Bilotta giuseppe.bilotta at gmail.com
Wed Sep 7 12:13:15 UTC 2016


0x followed by 15 `f` is 2^60-1, which is neither 2^64-1 (the maximum
value for an uint64_t) neither 2^44-1 (the value that would reside in
the upper 44 bits of a 64-bit numbers, which is what we want here).
It still work in the context, because the extra bits are just dropped
by the shift, but it's a rather odd constant _and_ it requires a type
specifier to avoid a warning (see previous commit).

Replace it by UINT64_MAX (2^64-1), which was probably the intended
value in the first place.
---
 src/cl_device_id.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/cl_device_id.c b/src/cl_device_id.c
index 6b3b521..46904ee 100644
--- a/src/cl_device_id.c
+++ b/src/cl_device_id.c
@@ -740,7 +740,7 @@ kbl_gt4_break:
   /* Apply any driver-dependent updates to the device info */
   cl_driver_update_device_info(ret);
 
-  #define toMB(size) (size)&(UINT64_C(0xfffffffffffffff)<<20)
+  #define toMB(size) (size)&(UINT64_MAX<<20)
   /* Get the global_mem_size and max_mem_alloc size from
    * driver, system ram and hardware*/
   struct sysinfo info;
-- 
2.8.1.372.g9612035



More information about the Beignet mailing list