1
0
Fork 0
mirror of https://github.com/Ellpeck/MLEM.git synced 2024-05-30 11:53:38 +02:00

don't use new caches for HasFlag and HasAnyFlag

This commit is contained in:
Ell 2021-09-05 16:26:05 +02:00
parent 54e3c98029
commit 05e320d4f4

View file

@ -59,7 +59,7 @@ namespace MLEM.Data {
if (this.allFlagsCache == null)
this.allFlagsCache = new Dictionary<DynamicEnum, bool>();
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<DynamicEnum, bool>();
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;