mirror of
https://github.com/kovidgoyal/kitty
synced 2026-06-06 01:05:48 +02:00
Bump go version to 1.21
Allows us to use the much faster builtin min/max functions for two variable min/max
This commit is contained in:
@@ -269,12 +269,12 @@ func NewDiffer() *Differ {
|
||||
// Use to create a signature and possibly apply a delta
|
||||
func NewPatcher(expected_input_size int64) (ans *Patcher) {
|
||||
bs := DefaultBlockSize
|
||||
sz := utils.Max(0, expected_input_size)
|
||||
sz := max(0, expected_input_size)
|
||||
if sz > 0 {
|
||||
bs = int(math.Round(math.Sqrt(float64(sz))))
|
||||
}
|
||||
ans = &Patcher{}
|
||||
ans.rsync.BlockSize = utils.Min(bs, MaxBlockSize)
|
||||
ans.rsync.BlockSize = min(bs, MaxBlockSize)
|
||||
ans.rsync.SetHasher(new_xxh3_64)
|
||||
ans.rsync.SetChecksummer(new_xxh3_128)
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ func run_roundtrip_test(t *testing.T, src_data, changed []byte, num_of_patches,
|
||||
|
||||
test_equal := func(src_data, output []byte) {
|
||||
if !bytes.Equal(src_data, output) {
|
||||
first_diff := utils.Min(len(src_data), len(output))
|
||||
first_diff := min(len(src_data), len(output))
|
||||
for i := 0; i < first_diff; i++ {
|
||||
if src_data[i] != output[i] {
|
||||
first_diff = i
|
||||
@@ -115,7 +115,7 @@ func run_roundtrip_test(t *testing.T, src_data, changed []byte, num_of_patches,
|
||||
outputbuf := bytes.Buffer{}
|
||||
p.StartDelta(&outputbuf, bytes.NewReader(changed))
|
||||
for len(deltabuf) > 0 {
|
||||
n := utils.Min(123, len(deltabuf))
|
||||
n := min(123, len(deltabuf))
|
||||
if err := p.UpdateDelta(deltabuf[:n]); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user