mirror of
https://github.com/Ellpeck/MLEM.git
synced 2024-12-26 02:09:24 +01:00
don't allow adding a flag with value 0 using AddFlag
This commit is contained in:
parent
81dcbfb9a1
commit
e620ed0d87
1 changed files with 2 additions and 2 deletions
|
@ -146,9 +146,9 @@ namespace MLEM.Data {
|
|||
/// <typeparam name="T">The type to add this value to</typeparam>
|
||||
/// <returns>The newly created enum value</returns>
|
||||
public static T AddFlag<T>(string name) where T : DynamicEnum {
|
||||
BigInteger value = 0;
|
||||
BigInteger value = 1;
|
||||
while (GetStorage(typeof(T)).Values.ContainsKey(value))
|
||||
value = value != 0 ? value << 1 : 1;
|
||||
value <<= 1;
|
||||
return Add<T>(name, value);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue