]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
include/byteorder: add constructor for ceph_le
authorKefu Chai <kchai@redhat.com>
Wed, 10 Mar 2021 05:33:14 +0000 (13:33 +0800)
committerKefu Chai <kchai@redhat.com>
Wed, 10 Mar 2021 08:56:44 +0000 (16:56 +0800)
so we can construct a ceph_le<> instance without using the init_le*()
helpers. this would improve the readability a little bit.

Signed-off-by: Kefu Chai <kchai@redhat.com>
src/include/byteorder.h

index f934145cb7baa4e17c86f3345ab4c02a23073ff1..189898121fd30feb03da7a5ca60e23de6c1d6426 100644 (file)
@@ -16,6 +16,10 @@ struct ceph_le {
 private:
   T v;
 public:
+  ceph_le() = default;
+  explicit ceph_le(T nv)
+    : v{boost::endian::native_to_little(nv)}
+  {}
   ceph_le<T>& operator=(T nv) {
     v = boost::endian::native_to_little(nv);
     return *this;