From 540bebab3947f043ee139956b59f7d8abdd50ab9 Mon Sep 17 00:00:00 2001 From: Andrea Bocci Date: Mon, 6 May 2024 16:18:00 +0200 Subject: [PATCH] Restrict utilities to integer types (#2264) --- include/alpaka/core/Utility.hpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/include/alpaka/core/Utility.hpp b/include/alpaka/core/Utility.hpp index 03ea7264b871..2610027ef360 100644 --- a/include/alpaka/core/Utility.hpp +++ b/include/alpaka/core/Utility.hpp @@ -1,4 +1,4 @@ -/* Copyright 2022 Benjamin Worpitz, René Widera, Bernhard Manfred Gruber, Jan Stephan +/* Copyright 2024 Benjamin Worpitz, René Widera, Bernhard Manfred Gruber, Jan Stephan, Andrea Bocci * SPDX-License-Identifier: MPL-2.0 */ #pragma once @@ -23,14 +23,14 @@ namespace alpaka::core #endif /// Returns the ceiling of a / b, as integer. - template + template>> [[nodiscard]] ALPAKA_FN_HOST_ACC constexpr auto divCeil(Integral a, Integral b) -> Integral { return (a + b - 1) / b; } /// Computes the nth power of base, in integers. - template + template>> [[nodiscard]] ALPAKA_FN_HOST_ACC constexpr auto intPow(Integral base, Integral n) -> Integral { if(n == 0) @@ -42,7 +42,7 @@ namespace alpaka::core } /// Computes the floor of the nth root of value, in integers. - template + template>> [[nodiscard]] ALPAKA_FN_HOST_ACC constexpr auto nthRootFloor(Integral value, Integral n) -> Integral { // adapted from: https://en.wikipedia.org/wiki/Integer_square_root @@ -58,4 +58,5 @@ namespace alpaka::core } return L; } + } // namespace alpaka::core