]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
common/hobject.h: don't reverse bits in zero 6653/head
authorPiotr Dałek <piotr.dalek@ts.fujitsu.com>
Thu, 19 Nov 2015 09:57:46 +0000 (10:57 +0100)
committerPiotr Dałek <piotr.dalek@ts.fujitsu.com>
Thu, 19 Nov 2015 09:57:46 +0000 (10:57 +0100)
Zero is passed in around 30% of all calls to _reverse_bits (and most of
them during daemon startup). Optimize this by not doing anything in
that special case and returning 0.

Signed-off-by: Piotr Dałek <piotr.dalek@ts.fujitsu.com>
src/common/hobject.h

index 4698756515556f62901fe20e76daa5c85ff89dd7..601af40fa43f6d1455e3a231d93c98e5250d51ca 100644 (file)
@@ -176,6 +176,8 @@ public:
   }
 
   static uint32_t _reverse_bits(uint32_t v) {
+    if (v == 0)
+      return v;
     // reverse bits
     // swap odd and even bits
     v = ((v >> 1) & 0x55555555) | ((v & 0x55555555) << 1);