[arrayfire] 90/408: Fix print macro

Ghislain Vaillant ghisvail-guest at moszumanska.debian.org
Mon Sep 21 19:11:25 UTC 2015


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

ghisvail-guest pushed a commit to branch debian/sid
in repository arrayfire.

commit 8f37d8cc0f383a95054d88bebb771612a4088b69
Author: Shehzan Mohammed <shehzan at arrayfire.com>
Date:   Thu Jul 2 15:56:37 2015 -0400

    Fix print macro
---
 include/af/util.h | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/include/af/util.h b/include/af/util.h
index e929464..4e19d20 100644
--- a/include/af/util.h
+++ b/include/af/util.h
@@ -43,13 +43,16 @@ namespace af
     AFAPI array exampleFunction(const array& in, const af_someenum_t param);
 }
 
+#define AF_PRINT1(exp)            af::print(#exp, exp);
+#define AF_PRINT2(exp, precision) af::print(#exp, exp, precision);
+
+#define GET_PRINT_MACRO(_1, _2, NAME, ...) NAME
+
 /**
     Macro to print an array along with the variable name
 
     \param[in] exp the array to be printed
-
-    An additional integer argument can be given to specify the precision to be
-    printed.
+    \param[in] precision (optional) is the number of decimal places to be printed
 
     \code
     af::array myarray = randu(3, 3);
@@ -67,7 +70,7 @@ namespace af
     //    60.33   497.97   359.59
     //   165.45   113.73     5.23
 
-    af_print(myarray, 6);
+    af_print(myarray, 6);               // Uses 6 decimal places
     // A [3 3 1 1]
     //     0.001029   311.361402     1.626432
     //    60.329828   497.973728   359.594787
@@ -76,7 +79,7 @@ namespace af
 
     \ingroup print_func_print
 */
-#define af_print(exp, ...) af::print(#exp, __VA_ARGS__);
+#define af_print(...) GET_PRINT_MACRO(__VA_ARGS__, AF_PRINT2, AF_PRINT1)(__VA_ARGS__)
 
 #endif //__cplusplus
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/arrayfire.git



More information about the debian-science-commits mailing list