Browse Source

refactored out dependency

combat-2
MagicBot 9 months ago
parent
commit
0ab7bafe5e
  1. 12
      src/engine/mbEnums.java

12
src/engine/mbEnums.java

@ -35,11 +35,13 @@ import java.util.concurrent.ThreadLocalRandom; @@ -35,11 +35,13 @@ import java.util.concurrent.ThreadLocalRandom;
public class mbEnums {
public static <T extends Enum<T>> long toLong(EnumSet<T> enumSet) {
long r = 0;
for (T value : enumSet) {
r |= 1L << value.ordinal();
}
return r;
long bitvector = 0L;
for (T value : enumSet)
bitvector |= 1L << value.ordinal();
return bitvector;
}
public static <E extends java.lang.Enum<E>> EnumSet<E> fromLong(long bitVector, Class<E> enumClass) {

Loading…
Cancel
Save