[arrayfire] 224/248: specilizations for abs math function for int & char

Ghislain Vaillant ghisvail-guest at moszumanska.debian.org
Tue Nov 17 15:54:30 UTC 2015


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

ghisvail-guest pushed a commit to branch dfsg-clean
in repository arrayfire.

commit 42d33017dbf28d942e1fb99fe7f6511fb77b2acc
Author: pradeep <pradeep at arrayfire.com>
Date:   Tue Nov 10 14:57:19 2015 -0500

    specilizations for abs math function for int & char
    
    abs(int) and abs(char) were always returning zeros on CUDA
    backend, probably a bug in CUDA sdk. This change fixes this
    behaviour on CUDA backend which effects the following functions:
    
    * af_assign_gen
    * af_index_gen
---
 src/backend/cuda/math.hpp | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/backend/cuda/math.hpp b/src/backend/cuda/math.hpp
index 1c495f6..ad7563f 100644
--- a/src/backend/cuda/math.hpp
+++ b/src/backend/cuda/math.hpp
@@ -23,6 +23,8 @@
 namespace cuda
 {
     template<typename T> static inline __DH__ T abs(T val)  { return abs(val); }
+    static inline __DH__ int  abs(int  val) { return (val>0? val : -val); }
+    static inline __DH__ char  abs(char  val) { return (val>0? val : -val); }
     static inline __DH__ float  abs(float  val) { return fabsf(val); }
     static inline __DH__ double abs(double val) { return fabs (val); }
     static inline __DH__ float  abs(cfloat  cval) { return cuCabsf(cval); }

-- 
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