Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 0 additions & 10 deletions Sources/FoundationEssentials/Decimal/Decimal+Compatibility.swift
Original file line number Diff line number Diff line change
Expand Up @@ -80,23 +80,13 @@ extension Decimal : _ObjectiveCBridgeable {
// MARK: - Bridging code to C functions
// We have one implementation function for each, and an entry point for both Darwin (cdecl, exported from the framework), and swift-corelibs-foundation (SPI here and available via that package as API)

#if FOUNDATION_FRAMEWORK
@available(macOS 10.10, iOS 8.0, watchOS 2.0, tvOS 9.0, *)
public func pow(_ x: Decimal, _ y: Int) -> Decimal {
let result = try? x._power(
exponent: y, roundingMode: .plain
)
return result ?? .nan
}
#else
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is pow available as API on Decimal itself instead of just via the free function?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My read is that this has always been a free function, both on Darwin and non-Darwin. This PR just unifies the code and makes it available for FoundationEssentials too.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto

@_spi(SwiftCorelibsFoundation)
public func _pow(_ x: Decimal, _ y: Int) -> Decimal {
let result = try? x._power(
exponent: y, roundingMode: .plain
)
return result ?? .nan
}
#endif

private func __NSDecimalAdd(
_ result: UnsafeMutablePointer<Decimal>,
Expand Down