diff options
| author | Dmitry Vyukov <dvyukov@google.com> | 2025-01-17 10:28:16 +0100 |
|---|---|---|
| committer | Dmitry Vyukov <dvyukov@google.com> | 2025-01-17 10:02:07 +0000 |
| commit | 5d04aae8969f6c72318ce0a4cde4f027766b1a55 (patch) | |
| tree | 8f1b632847c431407090f0fe1335522ff2195a37 /prog/encoding.go | |
| parent | f9e07a6e597b68d3397864e6ee4550f9065c3518 (diff) | |
all: use min/max functions
They are shorter, more readable, and don't require temp vars.
Diffstat (limited to 'prog/encoding.go')
| -rw-r--r-- | prog/encoding.go | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/prog/encoding.go b/prog/encoding.go index b614e247e..41a03d9fd 100644 --- a/prog/encoding.go +++ b/prog/encoding.go @@ -882,12 +882,8 @@ func (p *parser) parseAddr() (uint64, uint64, error) { } if !p.unsafe { maxMem := target.NumPages * target.PageSize - if vmaSize > maxMem { - vmaSize = maxMem - } - if addr > maxMem-vmaSize { - addr = maxMem - vmaSize - } + vmaSize = min(vmaSize, maxMem) + addr = min(addr, maxMem-vmaSize) } } p.Parse(')') |
