List of usage examples for org.apache.spark.unsafe.array ByteArrayMethods nextPowerOf2
public static long nextPowerOf2(long num)
From source file:edu.ucla.cs.wis.bigdatalog.spark.storage.map.BytesToBytesMap.java
License:Apache License
/** * Allocate new data structures for this map. When calling this outside of the constructor, * make sure to keep references to the old data structures so that you can free them. * * @param capacity the new map capacity/*from www .ja v a 2 s. c om*/ */ private void allocate(int capacity) { assert (capacity >= 0); capacity = Math.max((int) Math.min(MAX_CAPACITY, ByteArrayMethods.nextPowerOf2(capacity)), 64); assert (capacity <= MAX_CAPACITY); longArray = allocateArray(capacity * 2); longArray.zeroOut(); this.growthThreshold = (int) (capacity * loadFactor); this.mask = capacity - 1; }