diff options
author | Christian Grothoff <christian@grothoff.org> | 2019-12-25 16:14:57 +0100 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2019-12-25 16:14:57 +0100 |
commit | 64d6551e3c6608afcd5dfd5ebdf6ad9bbac0b9f5 (patch) | |
tree | 54b7297c6a6c7ffe5b7c9fcce09c520037339ee5 /src/include/gnunet_common.h | |
parent | d1dea55be8b970f9ecfec06695d03b0ccfcb9c2d (diff) | |
download | gnunet-64d6551e3c6608afcd5dfd5ebdf6ad9bbac0b9f5.tar.gz gnunet-64d6551e3c6608afcd5dfd5ebdf6ad9bbac0b9f5.zip |
replace expensive function call with macro for trivial calculation
Diffstat (limited to 'src/include/gnunet_common.h')
-rw-r--r-- | src/include/gnunet_common.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/include/gnunet_common.h b/src/include/gnunet_common.h index 3ac186e0b..36f9eee4a 100644 --- a/src/include/gnunet_common.h +++ b/src/include/gnunet_common.h | |||
@@ -997,6 +997,11 @@ GNUNET_error_type_to_string (enum GNUNET_ErrorType kind); | |||
997 | 997 | ||
998 | /* ************************* endianess conversion ****************** */ | 998 | /* ************************* endianess conversion ****************** */ |
999 | 999 | ||
1000 | #ifdef htonbe64 | ||
1001 | |||
1002 | #define GNUNET_htonll(n) htobe64 (n) | ||
1003 | |||
1004 | #else | ||
1000 | /** | 1005 | /** |
1001 | * Convert unsigned 64-bit integer to network byte order. | 1006 | * Convert unsigned 64-bit integer to network byte order. |
1002 | * | 1007 | * |
@@ -1008,7 +1013,14 @@ GNUNET_error_type_to_string (enum GNUNET_ErrorType kind); | |||
1008 | uint64_t | 1013 | uint64_t |
1009 | GNUNET_htonll (uint64_t n); | 1014 | GNUNET_htonll (uint64_t n); |
1010 | 1015 | ||
1016 | #endif | ||
1017 | |||
1011 | 1018 | ||
1019 | #ifdef be64toh | ||
1020 | |||
1021 | #define GNUNET_ntohll(n) be64toh (n) | ||
1022 | |||
1023 | #else | ||
1012 | /** | 1024 | /** |
1013 | * Convert unsigned 64-bit integer to host byte order. | 1025 | * Convert unsigned 64-bit integer to host byte order. |
1014 | * | 1026 | * |
@@ -1020,6 +1032,8 @@ GNUNET_htonll (uint64_t n); | |||
1020 | uint64_t | 1032 | uint64_t |
1021 | GNUNET_ntohll (uint64_t n); | 1033 | GNUNET_ntohll (uint64_t n); |
1022 | 1034 | ||
1035 | #endif | ||
1036 | |||
1023 | 1037 | ||
1024 | /** | 1038 | /** |
1025 | * Convert double to network byte order. | 1039 | * Convert double to network byte order. |