blob: 6b612461a1fe68acd1df4000d6e82dac5da9bbe9 [file] [edit]
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
package block
func isPowerOf2[T uint8 | uint16 | uint32 | uint64 | uint](num T) bool {
return (num != 0 && ((num & (num - 1)) == 0))
}