memcpy(p, &rev, sizeof(uint32_t));
}
+uint64_t nctoh64(const uint8_t *p) { // read 4 characters from *p and do ntohl on them
+ // this is to avoid possible aliasing violations
+ uint64_t value = nctohl(p);
+ uint64_t value_low = nctohl(p+4);
+ value = value << 32;
+ value = value + value_low;
+ return value;
+}
+
+
uint32_t nctohl(const uint8_t *p) { // read 4 characters from *p and do ntohl on them
// this is to avoid possible aliasing violations
uint32_t holder;
#endif
void hcton64(uint64_t num, uint8_t *p);
-uint32_t nctohl(const uint8_t *p); // read 4 characters from *p and do ntohl on them, avoiding aliasing
+
+//these are designed to avoid aliasing check errors
+uint64_t nctoh64(const uint8_t *p);
+uint32_t nctohl(const uint8_t *p);
uint16_t nctohs(const uint8_t *p);
uint64_t timespec_to_ns(struct timespec *tn);
uint64_t get_time_now();