Skip to content

Strange l #823

@fbacchella

Description

@fbacchella

I found a strange test in

if ((candidate.events & event) != 0) {
:

The whole function is:

        private static Event find(int event)
        {
            for (Event candidate : Event.values()) {
                if ((candidate.events & event) != 0) {
                    return candidate;
                }
            }
            // never arrives here, but anyway...
            return ALL;
        }
    }

What event is expected to be ? If it's a mask, as the test (candidate.events & event) != 0) implies, many values can fit. It's a single value, why bother with a binary and, an == will do the job ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions