src/fssum: Use htobe64() instead of a custom macro
authorRostislav Skudnov <rostislav@tuxera.com>
Tue, 23 Jan 2018 08:08:18 +0000 (08:08 +0000)
committerEryu Guan <eguan@redhat.com>
Wed, 24 Jan 2018 04:01:22 +0000 (12:01 +0800)
Remove unnecessary htonll() macro definition.

Macros and functions starting with two underscores are usually
internal and shouldn't be used by applications when a version
without "__" is available.

Signed-off-by: Rostislav Skudnov <rostislav@tuxera.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Eryu Guan <eguan@redhat.com>
src/fssum.c

index 13111d6fefecf11e860a8b1879b6a46b7314af96..2eaa236a6d7656ee52d7d3a77dd1dd69355dc1dd 100644 (file)
@@ -40,6 +40,7 @@
 #include <netinet/in.h>
 #include <inttypes.h>
 #include <assert.h>
+#include <endian.h>
 
 #define CS_SIZE 16
 #define CHUNKS 128
 #define SEEK_DATA 3
 #define SEEK_HOLE 4
 #endif
-
-#if __BYTE_ORDER == __LITTLE_ENDIAN
-#define htonll(x)     __bswap_64 (x)
-#else
-#define htonll(x)     (x)
-#endif
 #endif
 
 /* TODO: add hardlink recognition */
@@ -216,7 +211,7 @@ sum_add_sum(sum_t *dst, sum_t *src)
 void
 sum_add_u64(sum_t *dst, uint64_t val)
 {
-       uint64_t v = htonll(val);
+       uint64_t v = htobe64(val);
        sum_add(dst, &v, sizeof(v));
 }