From 05e320d4f484f6d385cef68b44aa2e91c10b76f1 Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Sun, 5 Sep 2021 16:26:05 +0200 Subject: [PATCH] don't use new caches for HasFlag and HasAnyFlag --- MLEM.Data/DynamicEnum.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/MLEM.Data/DynamicEnum.cs b/MLEM.Data/DynamicEnum.cs index dc4f14d..66de417 100644 --- a/MLEM.Data/DynamicEnum.cs +++ b/MLEM.Data/DynamicEnum.cs @@ -59,7 +59,7 @@ namespace MLEM.Data { if (this.allFlagsCache == null) this.allFlagsCache = new Dictionary(); if (!this.allFlagsCache.TryGetValue(flags, out var ret)) { - ret = And(this, flags) == flags; + ret = (GetValue(this) & GetValue(flags)) == GetValue(flags); this.allFlagsCache.Add(flags, ret); } return ret; @@ -75,7 +75,7 @@ namespace MLEM.Data { if (this.anyFlagsCache == null) this.anyFlagsCache = new Dictionary(); if (!this.anyFlagsCache.TryGetValue(flags, out var ret)) { - ret = GetValue(And(this, flags)) != 0; + ret = (GetValue(this) & GetValue(flags)) != 0; this.anyFlagsCache.Add(flags, ret); } return ret;