Helper to check if a specific flag bit is set.
bool hasFieldFlag(int flag) { return (flags & flag) != 0; }