MCPcopy Create free account
hub / github.com/0xsequence/czip / WriteWord

Method WriteWord

compressor/encode.go:313–326  ·  view source on GitHub ↗

Encodes and writes a word to the buffer

(word []byte, useStorage bool)

Source from the content-addressed store, hash-verified

311
312// Encodes and writes a word to the buffer
313func (buf *Buffer) WriteWord(word []byte, useStorage bool) (EncodeType, error) {
314 encoded, t, err := buf.EncodeWordOptimized(word, useStorage)
315 if err != nil {
316 return Stateless, err
317 }
318
319 paddedWord := make([]byte, 32)
320 copy(paddedWord[32-len(word):], word)
321
322 buf.commitBytes(encoded)
323 buf.end(paddedWord, t)
324
325 return t, nil
326}
327
328// Encodes N bytes, without any optimizations
329func (buf *Buffer) WriteNBytesRaw(bytes []byte) (EncodeType, error) {

Callers 9

WriteNWordsMethod · 0.95
WriteNBytesRawMethod · 0.95
WriteSequenceNonceMethod · 0.95
WriteSequenceExecuteMethod · 0.95
WriteBytesOptimizedMethod · 0.95
WriteCallMethod · 0.95

Calls 3

EncodeWordOptimizedMethod · 0.95
commitBytesMethod · 0.95
endMethod · 0.95

Tested by

no test coverage detected