MCPcopy Create free account
hub / github.com/Tracktion/choc / zigzagDecode

Function zigzagDecode

choc/memory/choc_VariableLengthEncoding.h:139–144  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

137
138template <typename IntegerType>
139IntegerType zigzagDecode (IntegerType n)
140{
141 auto un = static_cast<typename std::make_unsigned<IntegerType>::type> (n);
142 auto sn = static_cast<typename std::make_signed<IntegerType>::type> (n);
143 return static_cast<IntegerType> (static_cast<decltype (sn)> (un >> 1) ^ -(sn & static_cast<decltype (sn)> (1)));
144}
145
146} // namespace choc::integer_encoding
147

Callers 1

testPlatformFunction · 0.85

Calls

no outgoing calls

Tested by 1

testPlatformFunction · 0.68