[clinfo] 76/148: Cleanup memory presentation

Andreas Beckmann anbe at moszumanska.debian.org
Mon Nov 17 14:09:48 UTC 2014


This is an automated email from the git hooks/post-receive script.

anbe pushed a commit to branch clinfo
in repository clinfo.

commit efebf0d114a2e204fae0848e84c8d036ec05f83f
Author: Giuseppe Bilotta <giuseppe.bilotta at gmail.com>
Date:   Thu Oct 16 08:53:02 2014 +0200

    Cleanup memory presentation
    
    No whitespace in parenthesis, show KiB etc instead of KB etc, promote
    exact magnitude orders to the next (e.g. 1024KiB => 1MiB).
---
 src/clinfo.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/src/clinfo.c b/src/clinfo.c
index 8d59ced..1ff9f39 100644
--- a/src/clinfo.c
+++ b/src/clinfo.c
@@ -243,15 +243,15 @@ printDeviceInfo(cl_uint d)
 #define GB (MB*KB)
 #define TB (GB*KB)
 #define MEM_SIZE(val) ( \
-	val > TB ? val/TB : \
-	val > GB ? val/GB : \
-	val > MB ? val/MB : \
+	val >= TB ? val/TB : \
+	val >= GB ? val/GB : \
+	val >= MB ? val/MB : \
 	val/KB )
 #define MEM_PFX(val) ( \
-	val > TB ? "TB" : \
-	val > GB ? "GB" : \
-	val > MB ? "MB" : \
-	 "KB" )
+	val >= TB ? "TiB" : \
+	val >= GB ? "GiB" : \
+	val >= MB ? "MiB" : \
+	 "KiB" )
 
 #define STR_PARAM(param, str) \
 	SHOW_STRING(clGetDeviceInfo, CL_DEVICE_##param, "Device " str, dev)
@@ -282,7 +282,7 @@ printDeviceInfo(cl_uint d)
 #define MEM_PARAM_STR(var, fmt, name) do { \
 	doubleval = var; \
 	if (var > KB) { \
-		snprintf(strbuf, bufsz, " (%6.4lg%s)", \
+		snprintf(strbuf, bufsz, " (%.4lg%s)", \
 			MEM_SIZE(doubleval), \
 			MEM_PFX(doubleval)); \
 		strbuf[bufsz-1] = '\0'; \

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-opencl/clinfo.git



More information about the Pkg-opencl-commits mailing list