Flag testing

This commit is contained in:
2024-05-11 10:46:34 -04:00
parent ea2f6f4593
commit d55b57f7d0
2 changed files with 16 additions and 4 deletions
+10
View File
@@ -37,6 +37,16 @@ import java.util.concurrent.ThreadLocalRandom;
public class mbEnums {
public static <T extends Enum<T>> int toInt(EnumSet<T> enumSet) {
int bitvector = 0;
for (T value : enumSet)
bitvector |= 1 << value.ordinal();
return bitvector;
}
public static <T extends Enum<T>> long toLong(EnumSet<T> enumSet) {
long bitvector = 0L;