switch to uint64 cause native word length

This commit is contained in:
2026-05-06 20:08:04 -06:00
parent 8a2e6756cc
commit 3505f0e059
2 changed files with 3 additions and 2 deletions
+1 -1
View File
@@ -16,7 +16,7 @@ const userAgent = "pacman/7.1.0 (Linux x86_64) libalpm/16.0.1"
type Cache struct { type Cache struct {
cfg CacheConfig cfg CacheConfig
mirrorIdx atomic.Uint32 mirrorIdx atomic.Uint64
sf singleflight.Group //prevents duplicate downloads sf singleflight.Group //prevents duplicate downloads
mu sync.Mutex mu sync.Mutex
client http.Client client http.Client
+2 -1
View File
@@ -10,7 +10,8 @@ import (
func (c *Cache) nextMirror() string { func (c *Cache) nextMirror() string {
idx := c.mirrorIdx.Add(1) - 1 idx := c.mirrorIdx.Add(1) - 1
return c.cfg.mirrorURLs[idx%uint32(len(c.cfg.mirrorURLs))] mirrorCount := uint64(len(c.cfg.mirrorURLs))
return c.cfg.mirrorURLs[idx%mirrorCount]
} }
func downloadToDisk(url, destPath string, c http.Client) error { func downloadToDisk(url, destPath string, c http.Client) error {