MCPcopy Create free account
hub / github.com/Effect-TS/effect / sumBlock

Function sumBlock

packages/effect/src/encoding/Tar.ts:567–580  ·  view source on GitHub ↗
(block: Uint8Array)

Source from the content-addressed store, hash-verified

565}
566
567const sumBlock = (block: Uint8Array): number => {
568 // Four sums let the loop run faster than one
569 let a = 0
570 let b = 0
571 let c = 0
572 let d = 0
573 for (let i = 0; i < BLOCK; i += 4) {
574 a += block[i]
575 b += block[i + 1]
576 c += block[i + 2]
577 d += block[i + 3]
578 }
579 return a + b + c + d
580}
581
582const USTAR_MAGIC = [0x75, 0x73, 0x74, 0x61, 0x72, 0x00] // "ustar\0"
583const GNU_MAGIC = [0x75, 0x73, 0x74, 0x61, 0x72, 0x20, 0x20, 0x00] // "ustar \0"

Callers 2

verifyChecksumFunction · 0.85
writeUstarBlockFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected