Exemple #1
0
  @Test
  public void testNextPowTwo() {
    assertEquals(1, DataIO.nextPowTwo(1));
    assertEquals(2, DataIO.nextPowTwo(2));
    assertEquals(4, DataIO.nextPowTwo(3));
    assertEquals(4, DataIO.nextPowTwo(4));

    assertEquals(64, DataIO.nextPowTwo(33));
    assertEquals(64, DataIO.nextPowTwo(61));

    assertEquals(1024, DataIO.nextPowTwo(777));
    assertEquals(1024, DataIO.nextPowTwo(1024));

    assertEquals(1073741824, DataIO.nextPowTwo(1073741824 - 100));
    assertEquals(1073741824, DataIO.nextPowTwo((int) (1073741824 * 0.7)));
    assertEquals(1073741824, DataIO.nextPowTwo(1073741824));
  }
Exemple #2
0
  @Test
  public void testNextPowTwoLong() {
    assertEquals(1, DataIO.nextPowTwo(1L));
    assertEquals(2, DataIO.nextPowTwo(2L));
    assertEquals(4, DataIO.nextPowTwo(3L));
    assertEquals(4, DataIO.nextPowTwo(4L));

    assertEquals(64, DataIO.nextPowTwo(33L));
    assertEquals(64, DataIO.nextPowTwo(61L));

    assertEquals(1024, DataIO.nextPowTwo(777L));
    assertEquals(1024, DataIO.nextPowTwo(1024L));

    assertEquals(1073741824, DataIO.nextPowTwo(1073741824L - 100));
    assertEquals(1073741824, DataIO.nextPowTwo((long) (1073741824 * 0.7)));
    assertEquals(1073741824, DataIO.nextPowTwo(1073741824L));
  }