MCPcopy Index your code
hub / github.com/Monibuca/engine / Read

Method Read

util/bits/bits.go:46–62  ·  view source on GitHub ↗
(p []byte)

Source from the content-addressed store, hash-verified

44}
45
46func (self *Reader) Read(p []byte) (n int, err error) {
47 for n < len(p) {
48 want := 8
49 if len(p)-n < want {
50 want = len(p) - n
51 }
52 var bits uint64
53 if bits, err = self.ReadBits64(want * 8); err != nil {
54 break
55 }
56 for i := 0; i < want; i++ {
57 p[n+i] = byte(bits >> uint((want-i-1)*8))
58 }
59 n += want
60 }
61 return
62}
63
64type Writer struct {
65 W io.Writer

Callers 1

TestBitsFunction · 0.95

Calls 1

ReadBits64Method · 0.95

Tested by 1

TestBitsFunction · 0.76