mirror of
https://github.com/Ellpeck/MLEM.git
synced 2024-11-26 06:28:35 +01:00
Fixed DynamicEnum AddFlag going into an infinite loop
This commit is contained in:
parent
1bbb12a1fa
commit
81dcbfb9a1
2 changed files with 4 additions and 1 deletions
|
@ -51,6 +51,9 @@ Improvements
|
||||||
- Improved CopyExtensions construction speed
|
- Improved CopyExtensions construction speed
|
||||||
- Improved DynamicEnum caching
|
- Improved DynamicEnum caching
|
||||||
|
|
||||||
|
Fixes
|
||||||
|
- Fixed DynamicEnum AddFlag going into an infinite loop
|
||||||
|
|
||||||
## 5.0.0
|
## 5.0.0
|
||||||
### MLEM
|
### MLEM
|
||||||
Additions
|
Additions
|
||||||
|
|
|
@ -148,7 +148,7 @@ namespace MLEM.Data {
|
||||||
public static T AddFlag<T>(string name) where T : DynamicEnum {
|
public static T AddFlag<T>(string name) where T : DynamicEnum {
|
||||||
BigInteger value = 0;
|
BigInteger value = 0;
|
||||||
while (GetStorage(typeof(T)).Values.ContainsKey(value))
|
while (GetStorage(typeof(T)).Values.ContainsKey(value))
|
||||||
value <<= 1;
|
value = value != 0 ? value << 1 : 1;
|
||||||
return Add<T>(name, value);
|
return Add<T>(name, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue