libmicrohttpd

HTTP/1.x server C library (MHD 1.x, stable)
Log | Files | Refs | Submodules | README | LICENSE

commit 171e6d0591b0c81c6999a9e0d8f65b5624a76f15
parent 54afc7adb55557a524f992973a5c71d6dd43341f
Author: Evgeny Grin (Karlson2k) <k2k@narod.ru>
Date:   Fri,  6 May 2022 14:06:52 +0300

mhd_bithelpers: fixed handling of zero bits rotate

Diffstat:
Msrc/microhttpd/mhd_bithelpers.h | 4++++
1 file changed, 4 insertions(+), 0 deletions(-)

diff --git a/src/microhttpd/mhd_bithelpers.h b/src/microhttpd/mhd_bithelpers.h @@ -294,6 +294,8 @@ _MHD_static_inline uint32_t _MHD_ROTR32 (uint32_t value32, int bits) { bits %= 32; + if (0 == bits) + return value32; /* Defined in form which modern compiler could optimize. */ return (value32 >> bits) | (value32 << (32 - bits)); } @@ -322,6 +324,8 @@ _MHD_static_inline uint32_t _MHD_ROTL32 (uint32_t value32, int bits) { bits %= 32; + if (0 == bits) + return value32; /* Defined in form which modern compiler could optimize. */ return (value32 << bits) | (value32 >> (32 - bits)); }