MCPcopy Create free account
hub / github.com/comaps/comaps / ZigZagEncode

Function ZigZagEncode

libs/base/bits.hpp:32–36  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

30
31template <typename T>
32std::make_unsigned_t<T> ZigZagEncode(T x)
33{
34 static_assert(std::is_signed<T>::value, "Type should be signed");
35 return (x << 1) ^ (x >> (sizeof(x) * 8 - 1));
36}
37
38template <typename T>
39std::make_signed_t<T> ZigZagDecode(T x)

Callers 8

WriteVarIntFunction · 0.85
EncodePointDeltaAsUintFunction · 0.85
SerializeMethod · 0.85
WriteNodeFunction · 0.85
UNIT_TESTFunction · 0.85
EncodeZigZagDeltaFunction · 0.85
SerializeNotUTurnMethod · 0.85
SerializeUTurnMethod · 0.85

Calls

no outgoing calls

Tested by 1

UNIT_TESTFunction · 0.68