// Path: src/main/java/com/github/ffalcinelli/jdivert/Util.java
// public static int unsigned(short value) {
//     return value & 0x0000ffff;
// }
// 
// Path: src/main/java/com/github/ffalcinelli/jdivert/Util.java
// public static byte[] zeroPadArray(byte[] source, int size) {
//     byte[] data = new byte[size];
//     for (int i = 0; i < data.length; i++) {
//         if (i < source.length)
//             data[i] = source[i];
//         else
//             data[i] = 0;
//     }
//     return data;
// }


import java.nio.ByteBuffer;
import static com.github.ffalcinelli.jdivert.Util.unsigned;
import static com.github.ffalcinelli.jdivert.Util.zeroPadArray;
import static com.github.ffalcinelli.jdivert.headers.Tcp.Flag.NS;
        raw.put(start + 12, (byte) ((getDataOffset() << 4) | (reserved << 1) | (is(NS) ? 0x01 : 0x00)));
    }

    public boolean is(Flag flag) {
        if (flag == NS) {
            return getFlag(start + 12, 0);
        } else {
            //Starts by 8 since NS belongs to the previous byte
            return getFlag(start + 13, 8 - flag.ordinal());
        }
    }

    public void set(Flag flag, boolean value) {
        if (flag == NS) {
            setFlag(start + 12, 0, value);
        } else {
            //Starts by 8 since NS belongs to the previous byte
            setFlag(start + 13, 8 - flag.ordinal(), value);
        }
    }

    public int getFlags() {
        return raw.getShort(start + 12) & 0x01FF;
    }

    public void setFlags(int flags) {
        raw.putShort(start + 12, (short) ((getDataOffset() << 12) | (getReserved() << 5) | (flags & 0x01FF)));
    }

    public int getWindowSize() {
// Path: src/main/java/com/github/ffalcinelli/jdivert/Util.java
// public static int unsigned(short value) {
//     return value & 0x0000ffff;
// }
// 
// Path: src/main/java/com/github/ffalcinelli/jdivert/Util.java
// public static byte[] zeroPadArray(byte[] source, int size) {
//     byte[] data = new byte[size];
//     for (int i = 0; i < data.length; i++) {
//         if (i < source.length)
//             data[i] = source[i];
//         else
//             data[i] = 0;
//     }
//     return data;
// }


// Path: src/main/java/com/github/ffalcinelli/jdivert/headers/Tcp.java
import java.nio.ByteBuffer;
import static com.github.ffalcinelli.jdivert.Util.unsigned;
import static com.github.ffalcinelli.jdivert.Util.zeroPadArray;
import static com.github.ffalcinelli.jdivert.headers.Tcp.Flag.NS;

        raw.put(start + 12, (byte) ((getDataOffset() << 4) | (reserved << 1) | (is(NS) ? 0x01 : 0x00)));
    }

    public boolean is(Flag flag) {
        if (flag == NS) {
            return getFlag(start + 12, 0);
        } else {
            //Starts by 8 since NS belongs to the previous byte
            return getFlag(start + 13, 8 - flag.ordinal());
        }
    }

    public void set(Flag flag, boolean value) {
        if (flag == NS) {
            setFlag(start + 12, 0, value);
        } else {
            //Starts by 8 since NS belongs to the previous byte
            setFlag(start + 13, 8 - flag.ordinal(), value);
        }
    }

    public int getFlags() {
        return raw.getShort(start + 12) & 0x01FF;
    }

    public void setFlags(int flags) {
        raw.putShort(start + 12, (short) ((getDataOffset() << 12) | (getReserved() << 5) | (flags & 0x01FF)));
    }

    public int getWindowSize() {
        return unsigned(raw.getShort(start + 14));