Skip to content

Commit 5ed87b1

Browse files
committed
fix linux builds by keeping the decimal string init in a compiler directive
1 parent 849819f commit 5ed87b1

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

Sources/Floating Point Conversion.swift

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,11 @@ extension BigUInt {
4949
guard integer.sign == .plus else { return nil }
5050
assert(integer.floatingPointClass == .positiveNormal)
5151

52-
// keeping around in case the `Decimal._mantissa` property gets deprecated in the future.
53-
// let significand = BigUInt("\(integer.significand)")!
52+
#if os(Linux)
53+
// `Decimal._mantissa` has an internal access level on linux, and it might get
54+
// deprecated in the future, so keeping the string implementation around for now.
55+
let significand = BigUInt("\(integer.significand)")!
56+
#else
5457
let significand = {
5558
var start = BigUInt(0)
5659
for (place, value) in integer.significand.mantissaParts.enumerated() {
@@ -59,6 +62,7 @@ extension BigUInt {
5962
}
6063
return start
6164
}()
65+
#endif
6266
let exponent = BigUInt(10).power(integer.exponent)
6367

6468
self = significand * exponent

0 commit comments

Comments
 (0)