Flag testing
This commit is contained in:
1 parent
ea2f6f4593
commit
d55b57f7d0
2 files changed
+16
-4
No files matched your search
@@ -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;
|
||||
|
||||
Reference in new issue
Block a user