package io.netty.util.internal;

import io.netty.util.internal.shaded.org.jctools.util.Pow2;

/* JADX INFO: loaded from: classes.dex */
public final class MathUtil {
    public static final /* synthetic */ boolean $assertionsDisabled = false;

    private MathUtil() {
    }

    public static int compare(int i2, int i3) {
        if (i2 < i3) {
            return -1;
        }
        return i2 > i3 ? 1 : 0;
    }

    public static int compare(long j2, long j3) {
        if (j2 < j3) {
            return -1;
        }
        return j2 > j3 ? 1 : 0;
    }

    public static int findNextPositivePowerOfTwo(int i2) {
        return 1 << (32 - Integer.numberOfLeadingZeros(i2 - 1));
    }

    public static boolean isOutOfBounds(int i2, int i3, int i4) {
        int i5 = i2 | i3;
        int i6 = i2 + i3;
        return ((i5 | i6) | (i4 - i6)) < 0;
    }

    public static int safeFindNextPositivePowerOfTwo(int i2) {
        if (i2 <= 0) {
            return 1;
        }
        return i2 >= 1073741824 ? Pow2.MAX_POW2 : findNextPositivePowerOfTwo(i2);
    }
}
