mirror of
https://github.com/rclone/rclone.git
synced 2025-01-05 13:59:25 +01:00
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:
parent
9d4eab32d8
commit
be1a668e95
@ -136,7 +136,8 @@ func (q *quickXorHash) Write(p []byte) (n int, err error) {
|
|||||||
func (q *quickXorHash) checkSum() (h [Size]byte) {
|
func (q *quickXorHash) checkSum() (h [Size]byte) {
|
||||||
// Output the data as little endian bytes
|
// Output the data as little endian bytes
|
||||||
ph := 0
|
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+7] // bounds check
|
||||||
h[ph+0] = byte(d >> (8 * 0))
|
h[ph+0] = byte(d >> (8 * 0))
|
||||||
h[ph+1] = byte(d >> (8 * 1))
|
h[ph+1] = byte(d >> (8 * 1))
|
||||||
|
Loading…
Reference in New Issue
Block a user