Skip to content

Commit

Permalink
Revert "better solution for GCC compile error"
Browse files Browse the repository at this point in the history
This reverts commit a1546a5.
  • Loading branch information
chrxh committed May 21, 2024
1 parent a1546a5 commit e65d486
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
8 changes: 3 additions & 5 deletions source/EngineGpuKernels/Base.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -122,13 +122,11 @@ __device__ __inline__ T alienAtomicRead(T* const& address)
//
// Due to this, we need an ugly type casting workaround here
//
template <typename S, typename T, typename U = S>
__device__ __inline__ U alienAtomicAdd64(S* address, T const& value)
template <typename T>
__device__ __inline__ T alienAtomicAdd64(T* address, T const& value)
{
static_assert(sizeof(unsigned long long) == sizeof(T));
static_assert(sizeof(unsigned long long) == sizeof(S));
static_assert(sizeof(unsigned long long) == sizeof(U));
return reinterpret_cast<U>(atomicAdd(reinterpret_cast<unsigned long long*>(address), static_cast<unsigned long long>(value)));
return atomicAdd(reinterpret_cast<unsigned long long*>(address), static_cast<unsigned long long>(value));
}

template <typename T>
Expand Down
6 changes: 3 additions & 3 deletions source/EngineGpuKernels/DensityMap.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,13 @@ public:
auto index = toInt(cell->pos.x) / _slotSize + toInt(cell->pos.y) / _slotSize * _densityMapSize.x;
if (index >= 0 && index < _densityMapSize.x * _densityMapSize.y) {
auto color = calcMod(cell->color, MAX_COLORS);
alienAtomicAdd64(&_colorDensityMap[index], (1ull << (color * 8)) | (1ull << 56));
alienAtomicAdd64(&_colorDensityMap[index], static_cast<uint64_t>((1ull << (color * 8)) | (1ull << 56)));

if (cell->mutationId != 0) {
uint64_t bucket = calcBucket(cell->mutationId, timestep);
alienAtomicAdd64(&_otherMutantDensityMap[index], 0x0101010101010101ull ^ (1ull << (bucket * 8)));
alienAtomicAdd64(&_otherMutantDensityMap[index], static_cast<uint64_t>(0x0101010101010101ull ^ (1ull << (bucket * 8))));
} else {
alienAtomicAdd64(&_otherMutantDensityMap[index], 1ull);
alienAtomicAdd64(&_otherMutantDensityMap[index], static_cast<uint64_t>(1ull));
}
}
}
Expand Down

0 comments on commit e65d486

Please sign in to comment.