Skip to content

Commit

Permalink
Use binary operations for flag checking in hot path
Browse files Browse the repository at this point in the history
`HasFlag` is silly in debug mode.
  • Loading branch information
peppy committed Aug 19, 2024
1 parent 9e1178d commit 9d61253
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions osu.Framework/Graphics/Containers/CompositeDrawable.cs
Original file line number Diff line number Diff line change
Expand Up @@ -722,9 +722,9 @@ protected virtual bool CheckChildrenLife()
{
var state = checkChildLife(internalChildren[i]);

anyAliveChanged |= state.HasFlag(ChildLifeStateChange.MadeAlive) || state.HasFlag(ChildLifeStateChange.MadeDead);
anyAliveChanged |= (state & (ChildLifeStateChange.MadeAlive | ChildLifeStateChange.MadeDead)) > 0;

if (state.HasFlag(ChildLifeStateChange.Removed))
if ((state & ChildLifeStateChange.Removed) > 0)
i--;
}

Expand Down

0 comments on commit 9d61253

Please sign in to comment.