You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
extensionFixedWidthInteger{@inlinable@inline(__always)staticfunc bitRangesCoalesced(bits bitRanges:[Range<Int>])->Bool{ // << receives an arrays
letbitRanges= bitRanges.sorted{ $0.lowerBound < $1.lowerBound } // << sorting is not constant-foldable
varlowerBound=-1forbitRangein bitRanges {
// Specifically ensure that the bit ranges dont overlap, e.g. the
// following ranges are not valid: 0..<1, 0..<2. This is to ensure ranges
// are coalesced before iterating reduce the number of mask and shift
// operations needed.
guard lowerBound <= bitRange.lowerBound else{returnfalse}
lowerBound = bitRange.upperBound
}returntrue}
The text was updated successfully, but these errors were encountered:
Dynamic arrays are used in FixedWidthInteger.bitRangesCoalesced. Swift MMIO should really be allocations free. This was identified while investigating https://forums.swift.org/t/building-swift-mmio-for-stm32c011-with-no-allocations-results-in-compilation-error/75124.
The text was updated successfully, but these errors were encountered: