aboutsummaryrefslogtreecommitdiff
path: root/newlib/libc/stdlib/arc4random.c
diff options
context:
space:
mode:
authorJan Dubiec <jdx@o2.pl>2025-03-02 18:20:13 +0100
committerCorinna Vinschen <corinna@vinschen.de>2025-03-03 11:45:36 +0100
commit7962e3b26e5d6e8a1228baa63350321c8d9f31de (patch)
treea3c0491421dde3b9b8b565f01ef5063263adc365 /newlib/libc/stdlib/arc4random.c
parent627785b540bd9e119ad76cdac2dbe39221fdd2f2 (diff)
downloadnewlib-7962e3b26e5d6e8a1228baa63350321c8d9f31de.zip
newlib-7962e3b26e5d6e8a1228baa63350321c8d9f31de.tar.gz
newlib-7962e3b26e5d6e8a1228baa63350321c8d9f31de.tar.bz2
Silence -Wshift-count-overflow warnings
This patch fixes a few "left shift count >= width of type [-Wshift-count-overflow]" warnings. Before shifting a char 16 (or more) bits left first it explicitly casts the char to uint32_t. The existing code relies on implicit casts to int and assumes that ints are 32-bit. This is not always true because the C standard does not require int to be 32-bit and there are targets (e.g. H8/300) where by default int is indeed 16-bit. 2025-03-02 Jan Dubiec <jdx@o2.pl> newlib/ChangeLog: * libc/stdlib/gdtoa-gdtoa.c (gdtoa): Cast to __ULong before left shift. * libc/string/memmem.c (memmem): Cast to uint32_t before left shift. * libc/string/strstr.c (strstr2): Ditto. (strstr3): Ditto. (strstr4): Ditto. newlib/libc/stdlib/gdtoa-gdtoa.c | 2 +- newlib/libc/string/memmem.c | 3 ++- newlib/libc/string/strstr.c | 6 +++--- 3 files changed, 6 insertions(+), 5 deletions(-)
Diffstat (limited to 'newlib/libc/stdlib/arc4random.c')
0 files changed, 0 insertions, 0 deletions