From e5825bea71f6a955a12f03b474aad4569a1949c7 Mon Sep 17 00:00:00 2001
From: Stephan Seitz <stephan.seitz@fau.de>
Date: Mon, 27 Jul 2020 15:55:45 +0200
Subject: [PATCH] GPUField.impl.h: cast nrOfGhostLayers_ to cell_idx_t to
 suppress warnings

nrOfGhostLayers_ is unsigned while all cell_idx_t calculations are
signed.
---
 src/cuda/GPUField.impl.h | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/cuda/GPUField.impl.h b/src/cuda/GPUField.impl.h
index 702af9b66..54c3b40cc 100644
--- a/src/cuda/GPUField.impl.h
+++ b/src/cuda/GPUField.impl.h
@@ -96,9 +96,9 @@ GPUField<T>::~GPUField()
 template<typename T>
 T * GPUField<T>::dataAt(cell_idx_t x, cell_idx_t y, cell_idx_t z, cell_idx_t f)
 {
-   auto offset = (x + nrOfGhostLayers_) * xStride() +
-                 (y + nrOfGhostLayers_) * yStride() +
-                 (z + nrOfGhostLayers_) * zStride() +
+   auto offset = (x + cell_idx_c(nrOfGhostLayers_)) * xStride() +
+                 (y + cell_idx_c(nrOfGhostLayers_)) * yStride() +
+                 (z + cell_idx_c(nrOfGhostLayers_)) * zStride() +
                  f * fStride();
    return static_cast<T*>(pitchedPtr_.ptr) + offset;
 }
@@ -106,9 +106,9 @@ T * GPUField<T>::dataAt(cell_idx_t x, cell_idx_t y, cell_idx_t z, cell_idx_t f)
 template<typename T>
 const T * GPUField<T>::dataAt(cell_idx_t x, cell_idx_t y, cell_idx_t z, cell_idx_t f) const
 {
-   auto offset = (x + nrOfGhostLayers_) * xStride() +
-                 (y + nrOfGhostLayers_) * yStride() +
-                 (z + nrOfGhostLayers_) * zStride() +
+   auto offset = (x + cell_idx_c(nrOfGhostLayers_)) * xStride() +
+                 (y + cell_idx_c(nrOfGhostLayers_)) * yStride() +
+                 (z + cell_idx_c(nrOfGhostLayers_)) * zStride() +
                  f * fStride();
    return static_cast<T*>(pitchedPtr_.ptr) + offset;
 }
-- 
GitLab