From a1d2b03aaf1688c07b736381ab51a0f419affd42 Mon Sep 17 00:00:00 2001 From: yanxiang <1370277873@qq.com> Date: Mon, 23 Jun 2025 15:40:16 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=BA=86=E4=B8=80=E4=B8=AA?= =?UTF-8?q?=E8=AE=A1=E7=AE=97cacheway=E6=97=B6=E5=87=BA=E9=94=99=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pkg/services/dyncache/dyncache_init.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pkg/services/dyncache/dyncache_init.go b/pkg/services/dyncache/dyncache_init.go index 86a5dce..487e104 100644 --- a/pkg/services/dyncache/dyncache_init.go +++ b/pkg/services/dyncache/dyncache_init.go @@ -152,15 +152,15 @@ func calcLimitedCacheValue(path string, l3Percent int) (string, error) { if err != nil { return "", err } - ten, hundred, binValue := 10, 100, 0 + + hundred := 100 binLen := l3BinaryMask * l3Percent / hundred if binLen == 0 { binLen = 1 } - for i := 0; i < binLen; i++ { - binValue = binValue*ten + 1 - } - decValue, err := strconv.ParseInt(strconv.Itoa(binValue), base2, bitSize) + binValue := strings.Repeat("1", binLen) + + decValue, err := strconv.ParseInt(binValue, base2, bitSize) if err != nil { return "", fmt.Errorf("failed to transfer %v to decimal format: %v", binValue, err) } -- Gitee