[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[libmicrohttpd] 01/06: mhd_bithelpers: replaced macro with static functi
From: |
gnunet |
Subject: |
[libmicrohttpd] 01/06: mhd_bithelpers: replaced macro with static function |
Date: |
Sun, 16 May 2021 19:04:32 +0200 |
This is an automated email from the git hooks/post-receive script.
karlson2k pushed a commit to branch master
in repository libmicrohttpd.
commit 1265e687ffab6f0afcaff887049199bcd28adaaa
Author: Evgeny Grin (Karlson2k) <k2k@narod.ru>
AuthorDate: Sun May 16 17:53:45 2021 +0300
mhd_bithelpers: replaced macro with static function
Bit-rotating macro was replaced with static inline function to avoid two
time evaluation
and calculation of the parameters.
---
src/microhttpd/mhd_bithelpers.h | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
diff --git a/src/microhttpd/mhd_bithelpers.h b/src/microhttpd/mhd_bithelpers.h
index e023bf12..5d1aadef 100644
--- a/src/microhttpd/mhd_bithelpers.h
+++ b/src/microhttpd/mhd_bithelpers.h
@@ -26,13 +26,14 @@
#ifndef MHD_BITHELPERS_H
#define MHD_BITHELPERS_H 1
-#include "mhd_byteorder.h"
#include <stdint.h>
#if defined(_MSC_FULL_VER) && (! defined(__clang__) || (defined(__c2__) && \
defined(__OPTIMIZE__)))
/* Declarations for VC & Clang/C2 built-ins */
#include <intrin.h>
#endif /* _MSC_FULL_VER */
+#include "mhd_assert.h"
+#include "mhd_byteorder.h"
#ifndef __has_builtin
/* Avoid precompiler errors with non-clang */
@@ -230,9 +231,13 @@
#define _MHD_ROTR32(value32, bits) \
((uint32_t) _rotr ((uint32_t) (value32),(bits)))
#else /* ! _MSC_FULL_VER */
-/* Defined in form which modern compiler could optimize. */
-#define _MHD_ROTR32(value32, bits) \
- (((uint32_t) (value32)) >> (bits) | ((uint32_t) (value32)) << (32 - bits))
+_MHD_static_inline uint32_t
+_MHD_ROTR32 (uint32_t value32, int bits)
+{
+ mhd_assert (bits < 32);
+ /* Defined in form which modern compiler could optimize. */
+ return (value32 >> bits) | (value32 << (32 - bits));
+}
#endif /* ! _MSC_FULL_VER */
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
- [libmicrohttpd] branch master updated (8a9a64a7 -> 714c5735), gnunet, 2021/05/16
- [libmicrohttpd] 01/06: mhd_bithelpers: replaced macro with static function,
gnunet <=
- [libmicrohttpd] 03/06: sha256: re-arranged struct members to have better alignment, gnunet, 2021/05/16
- [libmicrohttpd] 05/06: sha256: formatting, cosmetics, typos in comments, gnunet, 2021/05/16
- [libmicrohttpd] 02/06: sha256: renamed one function for clarity and uniformity, gnunet, 2021/05/16
- [libmicrohttpd] 04/06: sha256: minor optimization, gnunet, 2021/05/16
- [libmicrohttpd] 06/06: Implemented SHA-1 calculation, gnunet, 2021/05/16