From c4dc646bee41c7e983a13750652f1035ae27b737 Mon Sep 17 00:00:00 2001 From: Aleksandr Nogikh Date: Thu, 14 Sep 2023 18:03:44 +0200 Subject: pkg/compiler: add ExistsAny() to ConstFile The new method checks whether the value is defined for at least one of the known arches. Refactor ConstFile tests. --- pkg/compiler/const_file.go | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'pkg/compiler/const_file.go') diff --git a/pkg/compiler/const_file.go b/pkg/compiler/const_file.go index 0df0bb0ca..1968092a4 100644 --- a/pkg/compiler/const_file.go +++ b/pkg/compiler/const_file.go @@ -82,6 +82,10 @@ func (cf *ConstFile) Arch(arch string) map[string]uint64 { return m } +func (cf *ConstFile) ExistsAny(constName string) bool { + return len(cf.m[constName].vals) > 0 +} + func (cf *ConstFile) Serialize() []byte { if len(cf.arches) == 0 { return nil -- cgit mrf-deployment