Encodes and writes a word to the buffer
(word []byte, useStorage bool)
| 311 | |
| 312 | // Encodes and writes a word to the buffer |
| 313 | func (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 |
| 329 | func (buf *Buffer) WriteNBytesRaw(bytes []byte) (EncodeType, error) { |
no test coverage detected