MCPcopy Create free account
hub / github.com/NVIDIA/cuda-tile / readSignedVarInt

Method readSignedVarInt

lib/Bytecode/Reader/BytecodeReader.cpp:118–124  ·  view source on GitHub ↗

Parse a signed variable length encoded integer from the byte stream. A signed varint is encoded as a normal varint with zigzag encoding applied, i.e. the low bit of the value is used to indicate the sign.

Source from the content-addressed store, hash-verified

116 /// signed varint is encoded as a normal varint with zigzag encoding applied,
117 /// i.e. the low bit of the value is used to indicate the sign.
118 LogicalResult readSignedVarInt(uint64_t &result) {
119 if (failed(readVarInt(result)))
120 return failure();
121 // Essentially (but using unsigned): (x >> 1) ^ -(x & 1).
122 result = (result >> 1) ^ (~(result & 1) + 1);
123 return success();
124 }
125
126 template <typename T>
127 std::enable_if_t<std::is_integral<T>::value, LogicalResult> readLE(T &value) {

Callers 4

parseAPIntMethod · 0.80
parseDivByAttrMethod · 0.80
parseOpAttributeMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected