From: Kefu Chai Date: Wed, 10 Mar 2021 05:33:14 +0000 (+0800) Subject: include/byteorder: add constructor for ceph_le X-Git-Tag: v17.1.0~2643^2~6 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=a606fedf07f3f81f184c0dacc973eaa09f13ac2e;p=ceph.git include/byteorder: add constructor for ceph_le 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 --- diff --git a/src/include/byteorder.h b/src/include/byteorder.h index f934145cb7ba..189898121fd3 100644 --- a/src/include/byteorder.h +++ b/src/include/byteorder.h @@ -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& operator=(T nv) { v = boost::endian::native_to_little(nv); return *this;