Operator "&" cannot be applied to byte, int, boolean

Viewed 6561

Upon my previous question about how to compare if combined bits contain a specific bit I am running into this error.

    int flag1 = 1 << 0;
    int flag4 = 1 << 5;

    int combined = flag1 | flag4;

    if (combined & flag1 == flag1) // <-- Operator & cannot be applied to int, boolean

If I cast the flags to byte the error replaces int with byte.

1 Answers
Related