Skip to content

Commit 4435d05

Browse files
committed
Use human-readable boolean operators.
1 parent 99945f4 commit 4435d05

1 file changed

Lines changed: 12 additions & 11 deletions

File tree

include/cuco/reduction_functors.cuh

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -98,39 +98,40 @@ class reduction_functor : detail::reduction_functor_base {
9898

9999
do {
100100
desired = functor_(old, rhs);
101-
} while (!lhs.compare_exchange_weak(
101+
} while (not lhs.compare_exchange_weak(
102102
old, desired, cuda::memory_order_release, cuda::memory_order_relaxed));
103103

104104
return desired;
105105
}
106-
if constexpr (!uses_external_sync()) { return functor_(lhs, rhs); }
106+
if constexpr (not uses_external_sync()) { return functor_(lhs, rhs); }
107107
}
108108

109109
__host__ __device__ value_type identity() const noexcept { return identity_.value(); }
110110

111111
__host__ __device__ static constexpr bool uses_external_sync() noexcept
112112
{
113-
return !atomic_invocable_ || naive_invocable_;
113+
return not atomic_invocable_ or naive_invocable_;
114114
}
115115

116116
private:
117117
cuco::identity_value<value_type> identity_;
118118
Func functor_;
119+
119120
static constexpr bool naive_invocable_ =
120121
cuda::std::is_invocable_r_v<value_type, Func, value_type, value_type>;
121122
static constexpr bool atomic_invocable_ =
122123
cuda::std::is_invocable_r_v<value_type,
123124
Func,
124125
cuda::atomic<value_type, cuda::thread_scope_system>&,
125-
value_type> ||
126+
value_type> or
126127
cuda::std::is_invocable_r_v<value_type,
127128
Func,
128129
cuda::atomic<value_type, cuda::thread_scope_device>&,
129-
value_type> ||
130+
value_type> or
130131
cuda::std::is_invocable_r_v<value_type,
131132
Func,
132133
cuda::atomic<value_type, cuda::thread_scope_block>&,
133-
value_type> ||
134+
value_type> or
134135
cuda::std::is_invocable_r_v<value_type,
135136
Func,
136137
cuda::atomic<value_type, cuda::thread_scope_thread>&,
@@ -139,24 +140,24 @@ class reduction_functor : detail::reduction_functor_base {
139140
cuda::std::is_invocable_r_v<value_type,
140141
Func,
141142
cuda::atomic<value_type, cuda::thread_scope_system> const&,
142-
value_type> ||
143+
value_type> or
143144
cuda::std::is_invocable_r_v<value_type,
144145
Func,
145146
cuda::atomic<value_type, cuda::thread_scope_device> const&,
146-
value_type> ||
147+
value_type> or
147148
cuda::std::is_invocable_r_v<value_type,
148149
Func,
149150
cuda::atomic<value_type, cuda::thread_scope_block> const&,
150-
value_type> ||
151+
value_type> or
151152
cuda::std::is_invocable_r_v<value_type,
152153
Func,
153154
cuda::atomic<value_type, cuda::thread_scope_thread> const&,
154155
value_type>;
155156

156-
static_assert((atomic_invocable_ && !atomic_const_invocable_) || naive_invocable_,
157+
static_assert((atomic_invocable_ and not atomic_const_invocable_) or naive_invocable_,
157158
"Invalid operator signature. Valid signatures are "
158159
"(T const&, T const&)->T and (cuda::atomic<T, Scope>&, T const&)->T.");
159-
static_assert(!(__nv_is_extended_device_lambda_closure_type(Func) ||
160+
static_assert(!(__nv_is_extended_device_lambda_closure_type(Func) or
160161
__nv_is_extended_host_device_lambda_closure_type(Func)),
161162
"Extended __device__/__host__ __device__ lambdas are not supported."
162163
" Use a named function object instead.");

0 commit comments

Comments
 (0)