MCPcopy Create free account
hub / github.com/compiler-explorer/compiler-explorer / compressedUInt

Function compressedUInt

test/dotnet-parser-tests.ts:93–103  ·  view source on GitHub ↗
(value: number)

Source from the content-addressed store, hash-verified

91}
92
93function compressedUInt(value: number): Buffer {
94 if (value < 0x80) {
95 return bytes(value);
96 }
97
98 if (value < 0x4000) {
99 return bytes(0x80 | (value >> 8), value & 0xff);
100 }
101
102 return bytes(0xc0 | (value >> 24), (value >> 16) & 0xff, (value >> 8) & 0xff, value & 0xff);
103}
104
105function compressedSignedInt(value: number): Buffer {
106 const encoded = value >= 0 ? value << 1 : (((1 << 6) + value) << 1) | 1;

Callers 7

compressedSignedIntFunction · 0.85
indexMethod · 0.85
methodSignatureFunction · 0.85
typeDefOrRefFunction · 0.85
genericInstanceFunction · 0.85
mdArrayFunction · 0.85
sequencePointsFunction · 0.85

Calls 1

bytesFunction · 0.85

Tested by

no test coverage detected