summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorChris Wilson <chris+github@qwirx.com>2010-02-16 23:05:33 +0000
committerChris Wilson <chris+github@qwirx.com>2010-02-16 23:05:33 +0000
commitd7409d428b372a9458981a9bbde3223238e68436 (patch)
treed4ecbd0b5ef6ceb0e0b3b4bd1108911eea184eb0 /lib
parent5a6308bdef212055d4edb746d37faf460a00d32c (diff)
Add overloaded hton() and ntoh() functions for file attribute comparison
macro.
Diffstat (limited to 'lib')
-rw-r--r--lib/common/Box.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/lib/common/Box.h b/lib/common/Box.h
index 4cab3a87..158fab7b 100644
--- a/lib/common/Box.h
+++ b/lib/common/Box.h
@@ -163,5 +163,23 @@ inline uint64_t box_swap64(uint64_t x)
#define box_ntoh64(x) box_swap64(x)
#endif
+// overloaded auto-conversion functions
+inline uint64_t hton(uint64_t in) { return box_hton64(in); }
+inline uint32_t hton(uint32_t in) { return htonl(in); }
+inline uint16_t hton(uint16_t in) { return htons(in); }
+inline uint8_t hton(uint8_t in) { return in; }
+inline int64_t hton(int64_t in) { return box_hton64(in); }
+inline int32_t hton(int32_t in) { return htonl(in); }
+inline int16_t hton(int16_t in) { return htons(in); }
+inline int8_t hton(int8_t in) { return in; }
+inline uint64_t ntoh(uint64_t in) { return box_ntoh64(in); }
+inline uint32_t ntoh(uint32_t in) { return ntohl(in); }
+inline uint16_t ntoh(uint16_t in) { return ntohs(in); }
+inline uint8_t ntoh(uint8_t in) { return in; }
+inline int64_t ntoh(int64_t in) { return box_ntoh64(in); }
+inline int32_t ntoh(int32_t in) { return ntohl(in); }
+inline int16_t ntoh(int16_t in) { return ntohs(in); }
+inline int8_t ntoh(int8_t in) { return in; }
+
#endif // BOX__H