本文整理了Java中io.airlift.slice.Slice.getUnsignedByte()
方法的一些代码示例,展示了Slice.getUnsignedByte()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Slice.getUnsignedByte()
方法的具体详情如下:
包路径:io.airlift.slice.Slice
类名称:Slice
方法名:getUnsignedByte
[英]Gets an unsigned byte at the specified absolute index in this buffer.
[中]获取此缓冲区中指定绝对索引处的无符号字节。
代码示例来源:origin: airlift/slice
k2 ^= ((long) data.getUnsignedByte(current + 14)) << 48;
case 14:
k2 ^= ((long) data.getUnsignedByte(current + 13)) << 40;
case 13:
k2 ^= ((long) data.getUnsignedByte(current + 12)) << 32;
case 12:
k2 ^= ((long) data.getUnsignedByte(current + 11)) << 24;
case 11:
k2 ^= ((long) data.getUnsignedByte(current + 10)) << 16;
case 10:
k2 ^= ((long) data.getUnsignedByte(current + 9)) << 8;
case 9:
k2 ^= ((long) data.getUnsignedByte(current + 8)) << 0;
k1 ^= ((long) data.getUnsignedByte(current + 7)) << 56;
case 7:
k1 ^= ((long) data.getUnsignedByte(current + 6)) << 48;
case 6:
k1 ^= ((long) data.getUnsignedByte(current + 5)) << 40;
case 5:
k1 ^= ((long) data.getUnsignedByte(current + 4)) << 32;
case 4:
k1 ^= ((long) data.getUnsignedByte(current + 3)) << 24;
case 3:
k1 ^= ((long) data.getUnsignedByte(current + 2)) << 16;
case 2:
k1 ^= ((long) data.getUnsignedByte(current + 1)) << 8;
case 1:
k1 ^= ((long) data.getUnsignedByte(current + 0)) << 0;
代码示例来源:origin: airlift/slice
@Test
public void testUnsignedByte()
{
int expected = 0xA5;
assertTrue(expected > 0);
assertEquals(slice.getUnsignedByte(0), expected);
}
代码示例来源:origin: io.airlift/slice
@Test
public void testUnsignedByte()
{
int expected = 0xA5;
assertTrue(expected > 0);
assertEquals(slice.getUnsignedByte(0), expected);
}
代码示例来源:origin: io.airlift/slice
k2 ^= ((long) data.getUnsignedByte(current + 14)) << 48;
case 14:
k2 ^= ((long) data.getUnsignedByte(current + 13)) << 40;
case 13:
k2 ^= ((long) data.getUnsignedByte(current + 12)) << 32;
case 12:
k2 ^= ((long) data.getUnsignedByte(current + 11)) << 24;
case 11:
k2 ^= ((long) data.getUnsignedByte(current + 10)) << 16;
case 10:
k2 ^= ((long) data.getUnsignedByte(current + 9)) << 8;
case 9:
k2 ^= ((long) data.getUnsignedByte(current + 8)) << 0;
k1 ^= ((long) data.getUnsignedByte(current + 7)) << 56;
case 7:
k1 ^= ((long) data.getUnsignedByte(current + 6)) << 48;
case 6:
k1 ^= ((long) data.getUnsignedByte(current + 5)) << 40;
case 5:
k1 ^= ((long) data.getUnsignedByte(current + 4)) << 32;
case 4:
k1 ^= ((long) data.getUnsignedByte(current + 3)) << 24;
case 3:
k1 ^= ((long) data.getUnsignedByte(current + 2)) << 16;
case 2:
k1 ^= ((long) data.getUnsignedByte(current + 1)) << 8;
case 1:
k1 ^= ((long) data.getUnsignedByte(current + 0)) << 0;
代码示例来源:origin: airlift/slice
@SuppressFBWarnings({"SF_SWITCH_NO_DEFAULT", "SF_SWITCH_FALLTHROUGH"})
public static int hash(int seed, Slice data, int offset, int length)
{
final int fastLimit = offset + length - SizeOf.SIZE_OF_INT + 1;
int h1 = seed;
int current = offset;
while (current < fastLimit) {
int k1 = mixK1(data.getInt(current));
current += SizeOf.SIZE_OF_INT;
h1 = mixH1(h1, k1);
}
int k1 = 0;
switch (length & 3) {
case 3:
k1 ^= ((int) data.getUnsignedByte(current + 2)) << 16;
case 2:
k1 ^= ((int) data.getUnsignedByte(current + 1)) << 8;
case 1:
k1 ^= ((int) data.getUnsignedByte(current + 0)) << 0;
}
h1 ^= mixK1(k1);
return fmix(h1, length);
}
代码示例来源:origin: io.airlift/slice
@SuppressFBWarnings({"SF_SWITCH_NO_DEFAULT", "SF_SWITCH_FALLTHROUGH"})
public static int hash(int seed, Slice data, int offset, int length)
{
final int fastLimit = offset + length - SizeOf.SIZE_OF_INT + 1;
int h1 = seed;
int current = offset;
while (current < fastLimit) {
int k1 = mixK1(data.getInt(current));
current += SizeOf.SIZE_OF_INT;
h1 = mixH1(h1, k1);
}
int k1 = 0;
switch (length & 3) {
case 3:
k1 ^= ((int) data.getUnsignedByte(current + 2)) << 16;
case 2:
k1 ^= ((int) data.getUnsignedByte(current + 1)) << 8;
case 1:
k1 ^= ((int) data.getUnsignedByte(current + 0)) << 0;
}
h1 ^= mixK1(k1);
return fmix(h1, length);
}
代码示例来源:origin: io.airlift/slice
k2 ^= ((long) data.getUnsignedByte(current + 14)) << 48;
case 14:
k2 ^= ((long) data.getUnsignedByte(current + 13)) << 40;
case 13:
k2 ^= ((long) data.getUnsignedByte(current + 12)) << 32;
case 12:
k2 ^= ((long) data.getUnsignedByte(current + 11)) << 24;
case 11:
k2 ^= ((long) data.getUnsignedByte(current + 10)) << 16;
case 10:
k2 ^= ((long) data.getUnsignedByte(current + 9)) << 8;
case 9:
k2 ^= ((long) data.getUnsignedByte(current + 8)) << 0;
k1 ^= ((long) data.getUnsignedByte(current + 7)) << 56;
case 7:
k1 ^= ((long) data.getUnsignedByte(current + 6)) << 48;
case 6:
k1 ^= ((long) data.getUnsignedByte(current + 5)) << 40;
case 5:
k1 ^= ((long) data.getUnsignedByte(current + 4)) << 32;
case 4:
k1 ^= ((long) data.getUnsignedByte(current + 3)) << 24;
case 3:
k1 ^= ((long) data.getUnsignedByte(current + 2)) << 16;
case 2:
k1 ^= ((long) data.getUnsignedByte(current + 1)) << 8;
case 1:
k1 ^= ((long) data.getUnsignedByte(current + 0)) << 0;
代码示例来源:origin: airlift/slice
public static void assertSlicesEqual(Slice actual, Slice expected)
{
if (actual == null && expected == null) {
return;
}
else if (actual == null) {
throw new AssertionError("Actual is null");
}
else if (expected == null) {
throw new AssertionError("Expected actual to be null");
}
if (actual.length() != expected.length()) {
throw new AssertionError(String.format("Slices differ in size. Actual: %s, expected: %s", actual.length(), expected.length()));
}
for (int i = 0; i < actual.length(); i++) {
if (actual.getByte(i) != expected.getByte(i)) {
throw new AssertionError(String.format("Slices differ at index %s. Actual: 0x%02x, expected: 0x%02x", i, actual.getUnsignedByte(i), expected.getUnsignedByte(i)));
}
}
}
}
代码示例来源:origin: airlift/slice
k2 ^= ((long) data.getUnsignedByte(current + 14)) << 48;
case 14:
k2 ^= ((long) data.getUnsignedByte(current + 13)) << 40;
case 13:
k2 ^= ((long) data.getUnsignedByte(current + 12)) << 32;
case 12:
k2 ^= ((long) data.getUnsignedByte(current + 11)) << 24;
case 11:
k2 ^= ((long) data.getUnsignedByte(current + 10)) << 16;
case 10:
k2 ^= ((long) data.getUnsignedByte(current + 9)) << 8;
case 9:
k2 ^= ((long) data.getUnsignedByte(current + 8)) << 0;
k1 ^= ((long) data.getUnsignedByte(current + 7)) << 56;
case 7:
k1 ^= ((long) data.getUnsignedByte(current + 6)) << 48;
case 6:
k1 ^= ((long) data.getUnsignedByte(current + 5)) << 40;
case 5:
k1 ^= ((long) data.getUnsignedByte(current + 4)) << 32;
case 4:
k1 ^= ((long) data.getUnsignedByte(current + 3)) << 24;
case 3:
k1 ^= ((long) data.getUnsignedByte(current + 2)) << 16;
case 2:
k1 ^= ((long) data.getUnsignedByte(current + 1)) << 8;
case 1:
k1 ^= ((long) data.getUnsignedByte(current + 0)) << 0;
代码示例来源:origin: io.airlift/slice
public static void assertSlicesEqual(Slice actual, Slice expected)
{
if (actual == null && expected == null) {
return;
}
else if (actual == null) {
throw new AssertionError("Actual is null");
}
else if (expected == null) {
throw new AssertionError("Expected actual to be null");
}
if (actual.length() != expected.length()) {
throw new AssertionError(String.format("Slices differ in size. Actual: %s, expected: %s", actual.length(), expected.length()));
}
for (int i = 0; i < actual.length(); i++) {
if (actual.getByte(i) != expected.getByte(i)) {
throw new AssertionError(String.format("Slices differ at index %s. Actual: 0x%02x, expected: 0x%02x", i, actual.getUnsignedByte(i), expected.getUnsignedByte(i)));
}
}
}
}
内容来源于网络,如有侵权,请联系作者删除!