Check if a number is a power of two.
(n: int)
| 73 | dim_in = 2 |
| 74 | |
| 75 | def is_power_of_two(n: int) -> bool: |
| 76 | """Check if a number is a power of two.""" |
| 77 | if n <= 0: |
| 78 | return False |
| 79 | return (n & (n - 1)) == 0 |
| 80 | |
| 81 | if not is_power_of_two(stride): |
| 82 | raise ValueError(f"Stride {stride} is not a power of two.") |
nothing calls this directly
no outgoing calls
no test coverage detected