SE-0288: Adding isPower(of:) to BinaryInteger

Sure! I just had it updated.

This is a very nice proposal - I agree that we should provide a more explicit API for the common case of power-of-2 checks. The way that you made this more general (to any power, including dynamic ones) without requiring duplicate public user APIs, and without sacrificing performance for the power of two case is really great.

Strong +1 from me,

-Chris

10 Likes

Just dropping in to leave a happy +1 for this :slight_smile:

Especially for powers of two this is a quite nice API and comes in handy.

1 Like

Thanks everyone for your feedback! The core team has decided to accept this proposal.

4 Likes
Terms of Service

Privacy Policy

Cookie Policy