The number of leading zeros in this value’s binary representation.
SDK
- Xcode 9.0+
Framework
- Swift Standard Library
Declaration
var leadingZeroBitCount: Int { get }
Discussion
For example, in an integer type with a bit
value of 8, the number 31 has three leading zeros.
let x: Int8 = 0b0001_1111
// x == 31
// x.leadingZeroBitCount == 3