onedrive: minor optimization of quickxorhash

This patch avoids creating a new slice header in favour of a for loop.

This saves a few instructions!
This commit is contained in:
Isaac Levy 2022-01-14 12:30:56 -05:00 committed by GitHub
parent 9d4eab32d8
commit be1a668e95
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 1 deletions

View File

@ -136,7 +136,8 @@ func (q *quickXorHash) Write(p []byte) (n int, err error) {
func (q *quickXorHash) checkSum() (h [Size]byte) {
// Output the data as little endian bytes
ph := 0
for _, d := range q.data[:len(q.data)-1] {
for i := 0; i < len(q.data)-1; i++ {
d := q.data[i]
_ = h[ph+7] // bounds check
h[ph+0] = byte(d >> (8 * 0))
h[ph+1] = byte(d >> (8 * 1))