mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[Darwin] simplify ilogb implementation in tgmath
This commit is contained in:
@@ -235,28 +235,16 @@ public func frexp(value: ${T}) -> (${T}, Int) {
|
||||
|
||||
% end
|
||||
|
||||
% # This would be AllFloatTypes not OverlayFloatTypes because of the Int return.
|
||||
% # ... except we need an _silgen_name to avoid an overload ambiguity.
|
||||
% for T, CT, f in OverlayFloatTypes():
|
||||
% # This is AllFloatTypes not OverlayFloatTypes because of the Int return.
|
||||
% for T, CT, f in AllFloatTypes():
|
||||
@_transparent
|
||||
@warn_unused_result
|
||||
public func ilogb(x: ${T}) -> Int {
|
||||
return Int(ilogb${f}(${CT}(x)))
|
||||
return Int(ilogb${f}(${CT}(x)) as CInt)
|
||||
}
|
||||
|
||||
% end
|
||||
|
||||
@warn_unused_result
|
||||
@_silgen_name("ilogb")
|
||||
func _swift_Darwin_ilogb(value: CDouble) -> CInt
|
||||
|
||||
@_transparent
|
||||
@warn_unused_result
|
||||
public func ilogb(x: Double) -> Int {
|
||||
return Int(_swift_Darwin_ilogb(CDouble(x)))
|
||||
}
|
||||
|
||||
|
||||
% # This is AllFloatTypes not OverlayFloatTypes because of the Int parameter.
|
||||
% for T, CT, f in AllFloatTypes():
|
||||
@_transparent
|
||||
|
||||
Reference in New Issue
Block a user