Skip to content

Commit da9f67c

Browse files
xwustephentyrone
authored andcommitted
[docs] Update trailingZeroBitCount documentation (swiftlang#24713)
* [docs] Update `trailingZeroBitCount` documentation Document the required behavior for `trailingZeroBitCount` when the value is zero. Namely, in that scenario, `trailingZeroBitCount` should be equal to `bitWidth`. * [docs] Address reviewer comments on `trailingZeroBitCount` docs
1 parent 70be266 commit da9f67c

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

stdlib/public/core/Integers.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -716,6 +716,8 @@ public protocol BinaryInteger :
716716
/// let x = Int8(bitPattern: 0b1111_1000)
717717
/// // x == -8
718718
/// // x.trailingZeroBitCount == 3
719+
///
720+
/// If the value is zero, then `trailingZeroBitCount` is equal to `bitWidth`.
719721
var trailingZeroBitCount: Int { get }
720722

721723
/// Returns the quotient of dividing the first value by the second.
@@ -2081,6 +2083,8 @@ where Magnitude : FixedWidthInteger & UnsignedInteger,
20812083
/// let x: Int8 = 0b0001_1111
20822084
/// // x == 31
20832085
/// // x.leadingZeroBitCount == 3
2086+
///
2087+
/// If the value is zero, then `leadingZeroBitCount` is equal to `bitWidth`.
20842088
var leadingZeroBitCount: Int { get }
20852089

20862090
/// Creates an integer from its big-endian representation, changing the byte

0 commit comments

Comments
 (0)