MCPcopy Create free account
hub / github.com/catboost/catboost / ZigZagEncode32

Function ZigZagEncode32

library/cpp/yson/zigzag.h:11–14  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

9 //! Actually taken 'as is' from protobuf/wire_format_lite.h
10
11 inline ui32 ZigZagEncode32(i32 n) {
12 // Note: the right-shift must be arithmetic
13 return (ui32(n) << 1) ^ (n >> 31);
14 }
15
16 inline i32 ZigZagDecode32(ui32 n) {
17 return (n >> 1) ^ -static_cast<i32>(n & 1);

Callers 1

WriteVarInt32Function · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected