BitOperations.IsPow2 for all supported integral types (#36163)
authorJohn Kelly <johnkellyoxford@gmail.com>
Mon, 8 Feb 2021 20:08:00 +0000 (20:08 +0000)
committerGitHub <noreply@github.com>
Mon, 8 Feb 2021 20:08:00 +0000 (20:08 +0000)
commit7ac05af45a7d4c6983439a76cffd4d6f4c1f9c40
treef56ca31ff4182058b8966e08f0fddef231313e9d
parent44f8f0faee42367bdd39277d8295f6e914ad7f4a
BitOperations.IsPow2 for all supported integral types (#36163)

* Add IsPow2

* Update BitOperationsTests.cs

* Refactor to static locals

* Add profiled software fallback

* Remove popcnt paths

* Remove popcnt usage as discussed

cc @tannergooding

* Invert branch

Discussed with tanner in DMs

* Update BitOperations.cs
src/libraries/System.Private.CoreLib/src/System/Numerics/BitOperations.cs
src/libraries/System.Runtime.Extensions/tests/System/Numerics/BitOperationsTests.cs
src/libraries/System.Runtime/ref/System.Runtime.cs