commit | 90d3a96dc28b40e6e5addbaa2889eb9246ef1c58 | [log] [tgz] |
---|---|---|
author | Davide Pesavento <davidepesa@gmail.com> | Fri Aug 25 21:21:31 2023 -0400 |
committer | Davide Pesavento <davidepesa@gmail.com> | Tue Aug 29 21:05:36 2023 -0400 |
tree | a5f9eed8859d90b2cdaae0799d41308b7db8696c | |
parent | fffdd62715188e4553aa470b79623fc75df07ac7 [diff] |
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); }