[arrayfire] 57/75: BUGFIX: Fixing getId() from ArrayInfo

Ghislain Vaillant ghisvail-guest at moszumanska.debian.org
Mon Feb 29 08:01:17 UTC 2016


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 0258883fe2a219c90456f97d86fd340c9f56940a
Author: Pavan Yalamanchili <pavan at arrayfire.com>
Date:   Tue Feb 23 18:19:36 2016 -0500

    BUGFIX: Fixing getId() from ArrayInfo
    
    - device id now occupies the last 8 bits.
---
 src/backend/ArrayInfo.cpp | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/src/backend/ArrayInfo.cpp b/src/backend/ArrayInfo.cpp
index a835353..0937641 100644
--- a/src/backend/ArrayInfo.cpp
+++ b/src/backend/ArrayInfo.cpp
@@ -35,33 +35,33 @@ int ArrayInfo::getDevId() const
 {
     // The actual device ID is only stored in the first 4 bits of devId
     // See ArrayInfo.hpp for more
-    return devId & 0xf;
+    return devId & 0xff;
 }
 
 void ArrayInfo::setId(int id) const
 {
-    // 1 << (backendId + 3) sets the 4th, 5th or 6th bit of devId to 1
+    // 1 << (backendId + 8) sets the 9th, 10th or 11th bit of devId to 1
     // for CPU, CUDA and OpenCL respectively
     // See ArrayInfo.hpp for more
     int backendId = detail::getBackend() >> 1; // Convert enums 1, 2, 4 to ints 0, 1, 2
-    const_cast<ArrayInfo *>(this)->setId(id | 1 << (backendId + 3));
+    const_cast<ArrayInfo *>(this)->setId(id | 1 << (backendId + 8));
 }
 
 void ArrayInfo::setId(int id)
 {
-    // 1 << (backendId + 3) sets the 4th, 5th or 6th bit of devId to 1
+    // 1 << (backendId + 3) sets the 9th, 10th or 11th bit of devId to 1
     // for CPU, CUDA and OpenCL respectively
     // See ArrayInfo.hpp for more
     int backendId = detail::getBackend() >> 1; // Convert enums 1, 2, 4 to ints 0, 1, 2
-    devId = id | 1 << (backendId + 3);
+    devId = id | 1 << (backendId + 8);
 }
 
 af_backend ArrayInfo::getBackendId() const
 {
-    // devId >> 3 converts the backend info to 1, 2, 4 which are enums
+    // devId >> 8 converts the backend info to 1, 2, 4 which are enums
     // for CPU, CUDA and OpenCL respectively
     // See ArrayInfo.hpp for more
-    int backendId = devId >> 3;
+    int backendId = devId >> 8;
     return (af_backend)backendId;
 }
 

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