Example usage for com.google.common.math LongMath isPowerOfTwo

List of usage examples for com.google.common.math LongMath isPowerOfTwo

Introduction

In this page you can find the example usage for com.google.common.math LongMath isPowerOfTwo.

Prototype

public static boolean isPowerOfTwo(long x) 

Source Link

Document

Returns true if x represents a power of two.

Usage

From source file:org.apache.impala.planner.ResourceProfile.java

ResourceProfile(boolean isValid, long memEstimateBytes, long minMemReservationBytes,
        long maxMemReservationBytes, long spillableBufferBytes, long maxRowBufferBytes,
        long threadReservation) {
    Preconditions.checkArgument(spillableBufferBytes == -1 || maxRowBufferBytes != -1);
    Preconditions.checkArgument(spillableBufferBytes == -1 || LongMath.isPowerOfTwo(spillableBufferBytes));
    Preconditions.checkArgument(maxRowBufferBytes == -1 || LongMath.isPowerOfTwo(maxRowBufferBytes));
    Preconditions.checkArgument(!isValid || threadReservation >= 0, threadReservation);
    isValid_ = isValid;/*from  ww w.java  2  s .  co  m*/
    memEstimateBytes_ = (minMemReservationBytes != -1) ? Math.max(memEstimateBytes, minMemReservationBytes)
            : memEstimateBytes;
    minMemReservationBytes_ = minMemReservationBytes;
    maxMemReservationBytes_ = maxMemReservationBytes;
    spillableBufferBytes_ = spillableBufferBytes;
    maxRowBufferBytes_ = maxRowBufferBytes;
    threadReservation_ = threadReservation;
}