1
0
mirror of https://github.com/rclone/rclone.git synced 2025-12-15 15:53:41 +00:00

build: drop support for go1.8

This commit is contained in:
Nick Craig-Wood
2019-04-15 20:03:33 +01:00
parent 613a9bb86b
commit 16d8014cbb
36 changed files with 40 additions and 202 deletions

View File

@@ -1,33 +0,0 @@
//+build !go1.9
package fstests
func leadingZeros64(x uint64) int {
var n uint64 = 64
if y := x >> 32; y != 0 {
n = n - 32
x = y
}
if y := x >> 16; y != 0 {
n = n - 16
x = y
}
if y := x >> 8; y != 0 {
n = n - 8
x = y
}
if y := x >> 4; y != 0 {
n = n - 4
x = y
}
if y := x >> 2; y != 0 {
n = n - 2
x = y
}
if y := x >> 1; y != 0 {
return int(n - 2)
}
return int(n - x)
}

View File

@@ -1,11 +0,0 @@
//+build go1.9
package fstests
import (
"math/bits"
)
func leadingZeros64(x uint64) int {
return bits.LeadingZeros64(x)
}

View File

@@ -11,6 +11,7 @@ import (
"fmt"
"io"
"io/ioutil"
"math/bits"
"os"
"path"
"path/filepath"
@@ -72,7 +73,7 @@ type SetUploadCutoffer interface {
// NextPowerOfTwo returns the current or next bigger power of two.
// All values less or equal 0 will return 0
func NextPowerOfTwo(i fs.SizeSuffix) fs.SizeSuffix {
return 1 << uint(64-leadingZeros64(uint64(i)-1))
return 1 << uint(64-bits.LeadingZeros64(uint64(i)-1))
}
// NextMultipleOf returns a function that can be used as a CeilChunkSize function.