]> Cypherpunks repositories - gostls13.git/commitdiff
crypto/subtle: use min builtin function in XORBytes
authorqiulaidongfeng <2645477756@qq.com>
Fri, 16 Feb 2024 10:24:55 +0000 (10:24 +0000)
committerGopher Robot <gobot@golang.org>
Fri, 16 Feb 2024 15:50:40 +0000 (15:50 +0000)
Change-Id: Ibf57dbaaa54486823e0769714dec2e22d6c5ea9e
GitHub-Last-Rev: 31421d066833f721f3fa261ac9dc49724fffb5f8
GitHub-Pull-Request: golang/go#65748
Reviewed-on: https://go-review.googlesource.com/c/go/+/564577
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Damien Neil <dneil@google.com>
Auto-Submit: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
src/crypto/subtle/xor.go

index a8805ac61dccf007b6cd2f7e26b0369127411bd6..158dbcede9046f021ffd53b9f7f890982d0a673a 100644 (file)
@@ -9,10 +9,7 @@ package subtle
 // If dst does not have length at least n,
 // XORBytes panics without writing anything to dst.
 func XORBytes(dst, x, y []byte) int {
-       n := len(x)
-       if len(y) < n {
-               n = len(y)
-       }
+       n := min(len(x), len(y))
        if n == 0 {
                return 0
        }