diff options
author | Chris Wilson <chris+github@qwirx.com> | 2010-02-16 23:05:33 +0000 |
---|---|---|
committer | Chris Wilson <chris+github@qwirx.com> | 2010-02-16 23:05:33 +0000 |
commit | d7409d428b372a9458981a9bbde3223238e68436 (patch) | |
tree | d4ecbd0b5ef6ceb0e0b3b4bd1108911eea184eb0 /lib | |
parent | 5a6308bdef212055d4edb746d37faf460a00d32c (diff) |
Add overloaded hton() and ntoh() functions for file attribute comparison
macro.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/common/Box.h | 18 |
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 |