diff --git a/Src/Particle/AMReX_Particle.H b/Src/Particle/AMReX_Particle.H index 7dab7e21f3..a67ddb8227 100644 --- a/Src/Particle/AMReX_Particle.H +++ b/Src/Particle/AMReX_Particle.H @@ -111,18 +111,19 @@ struct ParticleIDWrapper AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void flip_valid () noexcept { - // the leftmost bit is our id sign - we will XOR it with 1 to flip it + // The uppermost bit is our id inverse sign. + // We will XOR it with 1 to flip it. m_idata ^= static_cast(1) << 63; } - /** Check the sign of the id. + /** Check the particle is valid, via the sign of the id. * - * Returns false if the id is positive, otherwise true (invalid particle). + * Returns true if the particle is valid (the id is positive), otherwise false (invalid particle). */ [[nodiscard]] AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE - bool negative () const noexcept + bool is_valid () const noexcept { - // the leftmost bit is our id sign + // the leftmost bit is our id's inverse sign return m_idata >> 63; } }; @@ -199,13 +200,13 @@ struct ConstParticleIDWrapper /** Check the sign of the id. * - * Returns false if the id is positive, otherwise true (invalid particle). + * Returns true if the id is positive, otherwise false (invalid particle). */ [[nodiscard]] AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE - bool negative () const noexcept + bool is_valid () const noexcept { // the leftmost bit is our id's inverse sign - return !(m_idata >> 63); + return m_idata >> 63; } };