MCPcopy Create free account
hub / github.com/CobaltFusion/DebugViewPP / EmitCopyLessThan64

Function EmitCopyLessThan64

Libraries/snappy/snappy.cc:199–215  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

197}
198
199static inline char* EmitCopyLessThan64(char* op, size_t offset, int len) {
200 assert(len <= 64);
201 assert(len >= 4);
202 assert(offset < 65536);
203
204 if ((len < 12) && (offset < 2048)) {
205 size_t len_minus_4 = len - 4;
206 assert(len_minus_4 < 8); // Must fit in 3 bits
207 *op++ = COPY_1_BYTE_OFFSET + ((len_minus_4) << 2) + ((offset >> 8) << 5);
208 *op++ = offset & 0xff;
209 } else {
210 *op++ = COPY_2_BYTE_OFFSET + ((len-1) << 2);
211 LittleEndian::Store16(op, offset);
212 op += 2;
213 }
214 return op;
215}
216
217static inline char* EmitCopy(char* op, size_t offset, int len) {
218 // Emit 64 byte copies but make sure to keep at least four bytes reserved

Callers 1

EmitCopyFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected