commit cd7f2121e90572ca5c905fdbb65e28a4e6885186
parent bdf3919d9bb68305ab3b31790d6dd40d5bfcfb76
Author: Evgeny Grin (Karlson2k) <k2k@drgrin.dev>
Date: Fri, 25 Apr 2025 14:44:45 +0200
mhd_bithelpers: unified params for bit rotations, fixed compiler warnings
Diffstat:
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/src/mhd2/mhd_bithelpers.h b/src/mhd2/mhd_bithelpers.h
@@ -1,6 +1,6 @@
/*
This file is part of GNU libmicrohttpd
- Copyright (C) 2019-2023 Karlson2k (Evgeny Grin)
+ Copyright (C) 2019-2025 Karlson2k (Evgeny Grin)
GNU libmicrohttpd is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -343,7 +343,7 @@ mhd_PUT_64BIT_BE_UNALIGN (void *dst, uint64_t value)
# pragma intrinsic(_rotr)
# endif /* ! __clang__ */
# define mhd_ROTR32(value32, bits) \
- ((uint32_t) _rotr ((uint32_t) (value32),(bits)))
+ ((uint32_t) _rotr ((uint32_t) (value32), (int) (bits)))
#elif mhd_HAS_BUILTIN (__builtin_stdc_rotate_right)
# define mhd_ROTR32(value32, bits) \
(__builtin_stdc_rotate_right ((uint32_t) (value32), (bits)))
@@ -352,7 +352,7 @@ mhd_PUT_64BIT_BE_UNALIGN (void *dst, uint64_t value)
((uint32_t) __builtin_rotateright32 ((value32), (bits)))
#else /* ! __builtin_rotateright32 */
MHD_static_inline_ uint32_t
-mhd_ROTR32 (uint32_t value32, int bits)
+mhd_ROTR32 (uint32_t value32, unsigned int bits)
{
mhd_assert (32 > bits);
/* Defined in form which modern compiler could optimize. */
@@ -374,7 +374,7 @@ mhd_ROTR32 (uint32_t value32, int bits)
# pragma intrinsic(_rotl)
# endif /* ! __clang__ */
# define mhd_ROTL32(value32, bits) \
- ((uint32_t) _rotl ((uint32_t) (value32),(bits)))
+ ((uint32_t) _rotl ((uint32_t) (value32), (int) (bits)))
#elif mhd_HAS_BUILTIN (__builtin_stdc_rotate_left)
# define mhd_ROTL32(value32, bits) \
(__builtin_stdc_rotate_left ((uint32_t) (value32), (bits)))
@@ -383,7 +383,7 @@ mhd_ROTR32 (uint32_t value32, int bits)
((uint32_t) __builtin_rotateleft32 ((value32), (bits)))
#else /* ! __builtin_rotateleft32 */
MHD_static_inline_ uint32_t
-mhd_ROTL32 (uint32_t value32, int bits)
+mhd_ROTL32 (uint32_t value32, unsigned int bits)
{
mhd_assert (32 > bits);
/* Defined in form which modern compiler could optimize. */
@@ -405,7 +405,7 @@ mhd_ROTL32 (uint32_t value32, int bits)
# pragma intrinsic(_rotr64)
# endif /* ! __clang__ */
# define mhd_ROTR64(value64, bits) \
- ((uint64_t) _rotr64 ((uint64_t) (value64),(bits)))
+ ((uint64_t) _rotr64 ((uint64_t) (value64), (int) (bits)))
#elif mhd_HAS_BUILTIN (__builtin_stdc_rotate_right)
# define mhd_ROTR64(value64, bits) \
(__builtin_stdc_rotate_right ((uint64_t) (value64), (bits)))
@@ -414,7 +414,7 @@ mhd_ROTL32 (uint32_t value32, int bits)
((uint64_t) __builtin_rotateright64 ((value64), (bits)))
#else /* ! __builtin_rotateright64 */
MHD_static_inline_ uint64_t
-mhd_ROTR64 (uint64_t value64, int bits)
+mhd_ROTR64 (uint64_t value64, unsigned int bits)
{
mhd_assert (64 > bits);
/* Defined in form which modern compiler could optimise. */