From 810ea0957517bcfc459627aeb10a3594340c895b Mon Sep 17 00:00:00 2001 From: Jamie Liu Date: Wed, 1 Sep 2021 10:27:30 -0700 Subject: Cache cpuid.HostFeatureSet(). PiperOrigin-RevId: 394261815 --- pkg/cpuid/cpuid.go | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'pkg/cpuid/cpuid.go') diff --git a/pkg/cpuid/cpuid.go b/pkg/cpuid/cpuid.go index 69eeb7528..4d5e062a8 100644 --- a/pkg/cpuid/cpuid.go +++ b/pkg/cpuid/cpuid.go @@ -37,6 +37,14 @@ package cpuid // arch/arm64/include/uapi/asm/hwcap.h type Feature int +// HostFeatureSet returns a FeatureSet that matches that of the host machine. +// Callers must not mutate the returned FeatureSet. +func HostFeatureSet() *FeatureSet { + return hostFeatureSet +} + +var hostFeatureSet = getHostFeatureSet() + // ErrIncompatible is returned by FeatureSet.HostCompatible if fs is not a // subset of the host feature set. type ErrIncompatible struct { -- cgit v1.2.3