* lib/mbrtoc16.c (SET_EXTRA_STATE): Cast to 'unsigned int' before
shifting the bits to the positions 31..16.
+2024-09-10 Bruno Haible <bruno@clisp.org>
+
+ mbrtoc16: Fix undefined behaviour.
+ * lib/mbrtoc16.c (SET_EXTRA_STATE): Cast to 'unsigned int' before
+ shifting the bits to the positions 31..16.
+
2024-09-09 Bruno Haible <bruno@clisp.org>
string-desc: Fix undefined behaviour.
/* mbstate_t is defined in <bits/types/__mbstate_t.h>.
For more details, see glibc/iconv/skeleton.c. */
# define SET_EXTRA_STATE(ps, c16) \
- ((ps)->__count |= (c16 << 16))
+ ((ps)->__count |= ((unsigned int) (c16) << 16))
# define GET_EXTRA_STATE(ps) \
(((unsigned int) (ps)->__count) >> 16)
# define RESET_EXTRA_STATE(ps) \