]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/include/byteorder.h
import 15.2.0 Octopus source
[ceph.git] / ceph / src / include / byteorder.h
index 85268543143bc145112427aa43eb272210ce6077..03e30f84fc7d6eb57475ffc1d5901f53320242c3 100644 (file)
@@ -66,19 +66,19 @@ inline T mswab(T val) {
 
 template<typename T>
 struct ceph_le {
+private:
   T v;
+public:
   ceph_le<T>& operator=(T nv) {
     v = mswab(nv);
     return *this;
   }
   operator T() const { return mswab(v); }
+  friend inline bool operator==(ceph_le a, ceph_le b) {
+    return a.v == b.v;
+  }
 } __attribute__ ((packed));
 
-template<typename T>
-inline bool operator==(ceph_le<T> a, ceph_le<T> b) {
-  return a.v == b.v;
-}
-
 using ceph_le64 = ceph_le<__u64>;
 using ceph_le32 = ceph_le<__u32>;
 using ceph_le16 = ceph_le<__u16>;
@@ -99,11 +99,3 @@ inline ceph_le16 init_le16(__u16 x) {
   return v;
 }
 
-  /*
-#define cpu_to_le64(x) (x)
-#define cpu_to_le32(x) (x)
-#define cpu_to_le16(x) (x)
-  */
-#define le64_to_cpu(x) ((uint64_t)x)
-#define le32_to_cpu(x) ((__u32)x)
-#define le16_to_cpu(x) ((__u16)x)