Skip to content

Commit 9b6039e

Browse files
author
Kenneth Moreland
committed
Merge branch 'OverflowOptimizationWarning'
2 parents e93bd2e + e821164 commit 9b6039e

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/strategies/radixk.c

+5-2
Original file line numberDiff line numberDiff line change
@@ -132,8 +132,11 @@ static IceTInt* radixkGetK(IceTInt world_size, IceTInt* num_rounds_p)
132132

133133
/* If that does not work, look for a factor near the magic_k. */
134134
if (next_k == -1) {
135-
IceTInt try_k;
136-
BEGIN_PIVOT_FOR(try_k, 2, magic_k, 2*magic_k) {
135+
/* All these unsigned ints just get around a compiler warning
136+
about a compiler optimization that assumes no signed overflow.
137+
Yes, I am aware that all numbers will be positive. */
138+
IceTUInt try_k;
139+
BEGIN_PIVOT_FOR(try_k, 2, (IceTUInt)magic_k, 2*(IceTUInt)magic_k) {
137140
if ((next_divide % try_k) == 0) {
138141
next_k = try_k;
139142
break;

0 commit comments

Comments
 (0)