MCPcopy Create free account
hub / github.com/ethstorage/es-node / reassembleBytes

Function reassembleBytes

cmd/es-utils/utils/optimism_blob_encoder.go:215–225  ·  view source on GitHub ↗

reassembleBytes takes the 4x6-bit chunks from encodedByte, reassembles them into 3 bytes of output, and places them in their appropriate output positions.

(opos int, encodedByte []byte, output []byte)

Source from the content-addressed store, hash-verified

213// reassembleBytes takes the 4x6-bit chunks from encodedByte, reassembles them into 3 bytes of
214// output, and places them in their appropriate output positions.
215func reassembleBytes(opos int, encodedByte []byte, output []byte) int {
216 opos-- // account for fact that we don't output a 128th byte
217 x := (encodedByte[0] & 0b0011_1111) | ((encodedByte[1] & 0b0011_0000) << 2)
218 y := (encodedByte[1] & 0b0000_1111) | ((encodedByte[3] & 0b0000_1111) << 4)
219 z := (encodedByte[2] & 0b0011_1111) | ((encodedByte[3] & 0b0011_0000) << 2)
220 // put the re-assembled bytes in their appropriate output locations
221 output[opos-32] = z
222 output[opos-(32*2)] = y
223 output[opos-(32*3)] = x
224 return opos
225}

Callers 1

ToDataFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected