Skip to content

Commit

Permalink
Const-qualify half_t::operator+/* (#1726)
Browse files Browse the repository at this point in the history
These arithmetic operations do not and should not modify the current instance. Enables adding and multiplying const-qualified values of type half_t.
  • Loading branch information
bernhardmgruber authored May 13, 2024
1 parent 12c2892 commit 4640fae
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions cub/test/half.h
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
Expand All @@ -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));
}
Expand Down

0 comments on commit 4640fae

Please sign in to comment.