encoding: simplify readVarNumber()

Change-Id: I53ee1ec43d701a95aa79d8ea9f71dd61dbe74615
diff --git a/ndn-cxx/encoding/tlv.hpp b/ndn-cxx/encoding/tlv.hpp
index 86678ff..43a603b 100644
--- a/ndn-cxx/encoding/tlv.hpp
+++ b/ndn-cxx/encoding/tlv.hpp
@@ -358,8 +358,7 @@
     return true;
   }
 
-  size_t len = firstOctet == 253 ? 2 :
-               firstOctet == 254 ? 4 : 8;
+  size_t len = 1U << (firstOctet & 0b11);
   return detail::readNumber(len, begin, end, number);
 }