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

Function Extend

tensorflow/core/lib/hash/crc32c.cc:212–264  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

210}
211
212uint32 Extend(uint32 crc, const char *buf, size_t size) {
213 static bool can_accelerate = CanAccelerate();
214 if (can_accelerate) {
215 return AcceleratedExtend(crc, buf, size);
216 }
217
218 const uint8 *p = reinterpret_cast<const uint8 *>(buf);
219 const uint8 *e = p + size;
220 uint32 l = crc ^ 0xffffffffu;
221
222#define STEP1 \
223 do { \
224 int c = (l & 0xff) ^ *p++; \
225 l = table0_[c] ^ (l >> 8); \
226 } while (0)
227
228#define STEP4 \
229 do { \
230 uint32 c = l ^ LE_LOAD32(p); \
231 p += 4; \
232 l = table3_[c & 0xff] ^ table2_[(c >> 8) & 0xff] ^ \
233 table1_[(c >> 16) & 0xff] ^ table0_[c >> 24]; \
234 } while (0)
235
236 // Point x at first 4-byte aligned byte in string. This might be
237 // just past the end of the string.
238 const uintptr_t pval = reinterpret_cast<uintptr_t>(p);
239 const uint8 *x = reinterpret_cast<const uint8 *>(((pval + 3) >> 2) << 2);
240 if (x <= e) {
241 // Process bytes until finished or p is 4-byte aligned
242 while (p != x) {
243 STEP1;
244 }
245 }
246 // Process bytes 16 at a time
247 while ((e - p) >= 16) {
248 STEP4;
249 STEP4;
250 STEP4;
251 STEP4;
252 }
253 // Process bytes 4 at a time
254 while ((e - p) >= 4) {
255 STEP4;
256 }
257 // Process the last few bytes
258 while (p != e) {
259 STEP1;
260 }
261#undef STEP4
262#undef STEP1
263 return l ^ 0xffffffffu;
264}
265
266#if defined(PLATFORM_GOOGLE)
267uint32 Extend(uint32 crc, const absl::Cord &cord) {

Callers 14

ExtendMethod · 0.85
ExtendMethod · 0.85
AllocateRawInternalMethod · 0.85
WriteRawBlockMethod · 0.85
TESTFunction · 0.85
BM_CRCFunction · 0.85
ValueFunction · 0.85
ExtendMethod · 0.85
ReadStringTensorFunction · 0.85
ReadVariantTensorFunction · 0.85
WriteStringTensorFunction · 0.85
WriteVariantTensorFunction · 0.85

Calls 4

CanAccelerateFunction · 0.85
AcceleratedExtendFunction · 0.85
dataMethod · 0.45
sizeMethod · 0.45

Tested by 2

TESTFunction · 0.68
BM_CRCFunction · 0.68