(hash common.Hash, maxKvSize, idxWithinChunk uint64, realHash []byte, copyHash bool)
| 30 | } |
| 31 | |
| 32 | func ToRealHash(hash common.Hash, maxKvSize, idxWithinChunk uint64, realHash []byte, copyHash bool) []byte { |
| 33 | if len(realHash) != len(hash)+8 { |
| 34 | realHash = make([]byte, len(hash)+8) |
| 35 | // always copy hash if newly allocated |
| 36 | copy(realHash, hash[:]) |
| 37 | } else { |
| 38 | // otherwise only copy hash if requested |
| 39 | if copyHash { |
| 40 | copy(realHash, hash[:]) |
| 41 | } |
| 42 | } |
| 43 | |
| 44 | binary.BigEndian.PutUint64(realHash[len(hash):], maxKvSize+((idxWithinChunk+1)<<30) /* should be fine as long as MaxKvSize is < 2^30 */) |
| 45 | return realHash |
| 46 | } |
| 47 | |
| 48 | type PhyAddr struct { |
| 49 | KvIdx uint64 |
no outgoing calls
no test coverage detected