forked from EXTERNAL/bareiron
use libc htonll if found
This commit is contained in:
16
src/tools.c
16
src/tools.c
@@ -21,14 +21,16 @@
|
|||||||
#include "procedures.h"
|
#include "procedures.h"
|
||||||
#include "tools.h"
|
#include "tools.h"
|
||||||
|
|
||||||
static uint64_t htonll (uint64_t value) {
|
#ifndef htonll
|
||||||
#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
|
static uint64_t htonll (uint64_t value) {
|
||||||
return ((uint64_t)htonl((uint32_t)(value >> 32))) |
|
#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
|
||||||
((uint64_t)htonl((uint32_t)(value & 0xFFFFFFFF)) << 32);
|
return ((uint64_t)htonl((uint32_t)(value >> 32))) |
|
||||||
#else
|
((uint64_t)htonl((uint32_t)(value & 0xFFFFFFFF)) << 32);
|
||||||
return value;
|
#else
|
||||||
|
return value;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
|
||||||
|
|
||||||
// Keep track of the total amount of bytes received with recv_all
|
// Keep track of the total amount of bytes received with recv_all
|
||||||
// Helps notice misread packets and clean up after errors
|
// Helps notice misread packets and clean up after errors
|
||||||
|
Reference in New Issue
Block a user