Skip to content

Commit 8ecd884

Browse files
[stdlib] Expand integer conversion comment
1 parent 87c177c commit 8ecd884

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

stdlib/public/core/Integers.swift

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3010,7 +3010,10 @@ extension FixedWidthInteger {
30103010
let minBitWidth = source.significandWidth
30113011
let isExact = (minBitWidth <= exponent)
30123012
let bitPattern = source.significandBitPattern
3013-
// Determine the number of meaningful bits in the significand bit pattern.
3013+
// Determine the actual number of fractional significand bits.
3014+
// `Source.significandBitCount` would not reflect the actual number of
3015+
// fractional significand bits if `Source` is not a fixed-width floating-point
3016+
// type; we can compute this value as follows if `source` is finite:
30143017
let bitWidth = minBitWidth &+ bitPattern.trailingZeroBitCount
30153018
let shift = exponent - Source.Exponent(bitWidth)
30163019
// Use `Self.Magnitude` to prevent sign extension if `shift < 0`.

0 commit comments

Comments
 (0)