all: apply go fix
Updates #cleanup Signed-off-by: Adriano Sela Aviles <adriano@tailscale.com>
This commit is contained in:
committed by
Adriano Sela Aviles
parent
a5102d3fcb
commit
d69bf2685a
@@ -144,10 +144,7 @@ func (m *memBackend) ReadAt(p []byte, off int64) (int, error) {
|
||||
absOff := off + int64(total)
|
||||
page := absOff / memPageSize
|
||||
within := int(absOff % memPageSize)
|
||||
room := memPageSize - within
|
||||
if room > len(p)-total {
|
||||
room = len(p) - total
|
||||
}
|
||||
room := min(memPageSize-within, len(p)-total)
|
||||
if chunk, ok := m.pages[page]; ok {
|
||||
copy(p[total:total+room], chunk[within:within+room])
|
||||
}
|
||||
@@ -183,10 +180,7 @@ func (m *memBackend) WriteAt(p []byte, off int64) (int, error) {
|
||||
absOff := off + int64(total)
|
||||
page := absOff / memPageSize
|
||||
within := int(absOff % memPageSize)
|
||||
room := memPageSize - within
|
||||
if room > len(p)-total {
|
||||
room = len(p) - total
|
||||
}
|
||||
room := min(memPageSize-within, len(p)-total)
|
||||
chunk, ok := m.pages[page]
|
||||
if !ok && isAllZero(p[total:total+room]) {
|
||||
// Don't allocate a fresh zero page.
|
||||
|
||||
Reference in New Issue
Block a user