Skip to content

Commit

Permalink
Const-qualify half_t::operator+/*
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 committed May 8, 2024
1 parent d144111 commit 2dde09c
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 2dde09c

Please sign in to comment.