MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / WriteNumIncreasing

Method WriteNumIncreasing

tensorflow/core/lib/strings/ordered_code.cc:195–209  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

193}
194
195void OrderedCode::WriteNumIncreasing(string* dest, uint64 val) {
196 // Values are encoded with a single byte length prefix, followed
197 // by the actual value in big-endian format with leading 0 bytes
198 // dropped.
199 unsigned char buf[9]; // 8 bytes for value plus one byte for length
200 int len = 0;
201 while (val > 0) {
202 len++;
203 buf[9 - len] = (val & 0xff);
204 val >>= 8;
205 }
206 buf[9 - len - 1] = len;
207 len++;
208 AppendBytes(dest, reinterpret_cast<const char*>(buf + 9 - len), len);
209}
210
211// Parse the encoding of a previously encoded string.
212// If parse succeeds, return true, consume encoding from

Callers

nothing calls this directly

Calls 1

AppendBytesFunction · 0.85

Tested by

no test coverage detected