Search in sources :

Example 1 with Java9

use of net.openhft.chronicle.core.annotation.Java9 in project Chronicle-Bytes by OpenHFT.

the class VanillaBytes method isEqual0.

@Java9
private static boolean isEqual0(@NotNull byte[] bytes, byte coder, @NotNull NativeBytesStore bs, long address) {
    @Nullable Memory memory = bs.memory;
    if (coder == 0) {
        int i = 0;
        for (; i < bytes.length; i++) {
            byte b = memory.readByte(address + i);
            char c = (char) (bytes[i] & 0xFF);
            if (b != c) {
                return false;
            }
        }
    } else {
        int i = 0;
        for (; i < bytes.length; i++) {
            byte b = memory.readByte(address + i);
            char c = (char) (((bytes[i + 1] & 0xFF) << 8) | (bytes[i] & 0xFF));
            if (b != c) {
                return false;
            }
        }
    }
    return true;
}
Also used : Memory(net.openhft.chronicle.core.Memory) Nullable(org.jetbrains.annotations.Nullable) Java9(net.openhft.chronicle.core.annotation.Java9)

Aggregations

Memory (net.openhft.chronicle.core.Memory)1 Java9 (net.openhft.chronicle.core.annotation.Java9)1 Nullable (org.jetbrains.annotations.Nullable)1