Tidy up code to determine bit mask for ballot scans (#1363)

It seems more intuitive to set only the bits that are required, rather
than to set one more bit than is required, only to clear it again.

Signed-off-by: Stuart Brady <stuart.brady@arm.com>
This commit is contained in:
Stuart Brady
2021-12-02 15:27:30 +00:00
committed by GitHub
parent 7625011b66
commit f8ec235d3c

View File

@@ -437,9 +437,9 @@ template <typename Ty, BallotOp operation> struct BALLOT_COUNT_SCAN_FIND
else if (operation == BallotOp::ballot_inclusive_scan else if (operation == BallotOp::ballot_inclusive_scan
|| operation == BallotOp::ballot_exclusive_scan) || operation == BallotOp::ballot_exclusive_scan)
{ {
for (cl_uint i = 0; i <= sub_group_local_id; ++i) mask.set(i); for (cl_uint i = 0; i < sub_group_local_id; ++i) mask.set(i);
if (operation == BallotOp::ballot_exclusive_scan) if (operation == BallotOp::ballot_inclusive_scan)
mask.reset(sub_group_local_id); mask.set(sub_group_local_id);
} }
return mask; return mask;
} }