Switch uses of <unistd.h> to <folly/portability/Unistd.h>
[folly.git] / folly / experimental / EventCount.h
index e0f5a94d6975988ce885c264f0632a69e0d8062e..a9feddfd83f8228320be48c305d596957e9d62fc 100644 (file)
 
 #pragma once
 
-#include <unistd.h>
 #include <syscall.h>
 #include <linux/futex.h>
-#include <sys/time.h>
 #include <climits>
 #include <atomic>
 #include <thread>
@@ -27,6 +25,8 @@
 
 #include <folly/Bits.h>
 #include <folly/Likely.h>
+#include <folly/portability/SysTime.h>
+#include <folly/portability/Unistd.h>
 
 
 namespace folly {
@@ -126,13 +126,7 @@ class EventCount {
   static_assert(sizeof(uint32_t) == 4, "bad platform");
   static_assert(sizeof(uint64_t) == 8, "bad platform");
 
-#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
-  static constexpr size_t kEpochOffset = 1;
-#elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
-  static constexpr size_t kEpochOffset = 0;  // in units of sizeof(int)
-#else
-# error Your machine uses a weird endianness!
-#endif
+  static constexpr size_t kEpochOffset = kIsLittleEndian ? 1 : 0;
 
   // val_ stores the epoch in the most significant 32 bits and the
   // waiter count in the least significant 32 bits.