From 2dde09c4ee334d703ed9920330b648eaff0c6caf Mon Sep 17 00:00:00 2001 From: Bernhard Manfred Gruber Date: Wed, 8 May 2024 17:05:35 +0200 Subject: [PATCH] Const-qualify half_t::operator+/* These arithmetic operations do not and should not modify the current instance. Enables adding and multiplying const-qualified values of type half_t. --- cub/test/half.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cub/test/half.h b/cub/test/half.h index 18441e5f1b..3b497131d7 100644 --- a/cub/test/half.h +++ b/cub/test/half.h @@ -238,7 +238,7 @@ struct half_t } /// Multiply - __host__ __device__ __forceinline__ half_t operator*(const half_t& other) + __host__ __device__ __forceinline__ half_t operator*(const half_t& other) const { return half_t(float(*this) * float(other)); } @@ -250,7 +250,7 @@ struct half_t } /// Add - __host__ __device__ __forceinline__ half_t operator+(const half_t& other) + __host__ __device__ __forceinline__ half_t operator+(const half_t& other) const { return half_t(float(*this) + float(other)); }