From 5d04aae8969f6c72318ce0a4cde4f027766b1a55 Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Fri, 17 Jan 2025 10:28:16 +0100 Subject: all: use min/max functions They are shorter, more readable, and don't require temp vars. --- prog/encoding.go | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'prog/encoding.go') 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(')') -- cgit mrf-deployment