On 2026-03-07 21:15, Jeffrey Walton wrote:
C2y says that these functions don't have that restriction: if the number
of bits is N, then rotating by nonnegative R is equivalent to rotating
by R % N. So there's no need for an assertion to check that the shift
argument is in range.

If that is the case, then the masking is not needed:

+# if ! defined __gl_stdc_rotate_left
+#  define __gl_stdc_rotate_left(value, count)             \
+  ((value << (count & (sizeof value * 8 - 1)))            \
+   | (value >> ((-count) & (sizeof value * 8 - 1))))
+# endif

The masking is needed there, because << and >> have the range restriction in question, even though __gl_stdc_rotate_left does not.

And since we have the needed masking, there's no need for an assert.

Reply via email to