// Path: src/main/java/eu/rekawek/coffeegb/cpu/BitUtils.java
// public static void checkByteArgument(String argumentName, int argument) {
//     checkArgument(argument >= 0 && argument <= 0xff, "Argument {} should be a byte", argumentName);
// }
// 
// Path: src/main/java/eu/rekawek/coffeegb/cpu/BitUtils.java
// public static boolean getBit(int byteValue, int position) {
//     return (byteValue & (1 << position)) != 0;
// }
// 
// Path: src/main/java/eu/rekawek/coffeegb/cpu/BitUtils.java
// public static int setBit(int byteValue, int position, boolean value) {
//     return value ? setBit(byteValue, position) : clearBit(byteValue, position);
// }


import static eu.rekawek.coffeegb.cpu.BitUtils.checkByteArgument;
import static eu.rekawek.coffeegb.cpu.BitUtils.getBit;
import static eu.rekawek.coffeegb.cpu.BitUtils.setBit;

    public void setZ(boolean z) {
        flags = setBit(flags, Z_POS, z);
    }

    public void setN(boolean n) {
        flags = setBit(flags, N_POS, n);
    }

    public void setH(boolean h) {
        flags = setBit(flags, H_POS, h);
    }

    public void setC(boolean c) {
        flags = setBit(flags, C_POS, c);
    }

    public void setFlagsByte(int flags) {
        checkByteArgument("flags", flags);
        this.flags = flags & 0xf0;
    }

    @Override
    public String toString() {
        StringBuilder result = new StringBuilder();
        result.append(isZ() ? 'Z' : '-');
        result.append(isN() ? 'N' : '-');
        result.append(isH() ? 'H' : '-');
        result.append(isC() ? 'C' : '-');
        result.append("----");
// Path: src/main/java/eu/rekawek/coffeegb/cpu/BitUtils.java
// public static void checkByteArgument(String argumentName, int argument) {
//     checkArgument(argument >= 0 && argument <= 0xff, "Argument {} should be a byte", argumentName);
// }
// 
// Path: src/main/java/eu/rekawek/coffeegb/cpu/BitUtils.java
// public static boolean getBit(int byteValue, int position) {
//     return (byteValue & (1 << position)) != 0;
// }
// 
// Path: src/main/java/eu/rekawek/coffeegb/cpu/BitUtils.java
// public static int setBit(int byteValue, int position, boolean value) {
//     return value ? setBit(byteValue, position) : clearBit(byteValue, position);
// }


// Path: src/main/java/eu/rekawek/coffeegb/cpu/Flags.java
import static eu.rekawek.coffeegb.cpu.BitUtils.checkByteArgument;
import static eu.rekawek.coffeegb.cpu.BitUtils.getBit;
import static eu.rekawek.coffeegb.cpu.BitUtils.setBit;


    public void setZ(boolean z) {
        flags = setBit(flags, Z_POS, z);
    }

    public void setN(boolean n) {
        flags = setBit(flags, N_POS, n);
    }

    public void setH(boolean h) {
        flags = setBit(flags, H_POS, h);
    }

    public void setC(boolean c) {
        flags = setBit(flags, C_POS, c);
    }

    public void setFlagsByte(int flags) {
        checkByteArgument("flags", flags);
        this.flags = flags & 0xf0;
    }

    @Override
    public String toString() {
        StringBuilder result = new StringBuilder();
        result.append(isZ() ? 'Z' : '-');
        result.append(isN() ? 'N' : '-');
        result.append(isH() ? 'H' : '-');
        result.append(isC() ? 'C' : '-');
        result.append("----");
        return result.toString();