summaryrefslogtreecommitdiff
path: root/src/main/java/org/mamago/util/Bits.java
blob: 4672ea9cef51d0a529d865fa8307e94d1285d9c3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
package org.mamago.util;

public class Bits {
    // Prevent instantiation
    private Bits() {}

    public static int roundUpToLongSize(int size) {
        return roundUpToSize(size, 8);
    }

    public static int roundUpToSize(int size, int width) {
        // Formula:
        //   (size + w) / w * w; // Adding w rounds up to the next whole width
        return ((size + width) / width) * width;
    }
}