[stdlib] Propagate IntegerArithmeticType docs

184 undocumented public non-operator APIs remain in core

Swift SVN r22227
This commit is contained in:
Dave Abrahams
2014-09-23 20:16:36 +00:00
parent 3f4e7f5bc8
commit ea47b64bcc
3 changed files with 43 additions and 14 deletions

View File

@@ -104,30 +104,40 @@ extension Bit : IntegerArithmeticType {
return (Bit(rawValue: v.0)!, v.overflow)
}
/// Add `lhs` and `rhs`, returning a result and a `Bool` that is
/// true iff the operation caused an arithmetic overflow.
public static func addWithOverflow(
lhs: Bit, _ rhs: Bit
) -> (Bit, overflow: Bool) {
return _withOverflow(Int.addWithOverflow(lhs.rawValue, rhs.rawValue))
}
/// Subtract `lhs` and `rhs`, returning a result and a `Bool` that is
/// true iff the operation caused an arithmetic overflow.
public static func subtractWithOverflow(
lhs: Bit, _ rhs: Bit
) -> (Bit, overflow: Bool) {
return _withOverflow(Int.subtractWithOverflow(lhs.rawValue, rhs.rawValue))
}
/// Multiply `lhs` and `rhs`, returning a result and a `Bool` that is
/// true iff the operation caused an arithmetic overflow.
public static func multiplyWithOverflow(
lhs: Bit, _ rhs: Bit
) -> (Bit, overflow: Bool) {
return _withOverflow(Int.multiplyWithOverflow(lhs.rawValue, rhs.rawValue))
}
/// Divide `lhs` and `rhs`, returning a result and a `Bool` that is
/// true iff the operation caused an arithmetic overflow.
public static func divideWithOverflow(
lhs: Bit, _ rhs: Bit
) -> (Bit, overflow: Bool) {
return _withOverflow(Int.divideWithOverflow(lhs.rawValue, rhs.rawValue))
}
/// Divide `lhs` and `rhs`, returning the remainder and a `Bool` that is
/// true iff the operation caused an arithmetic overflow.
public static func remainderWithOverflow(
lhs: Bit, _ rhs: Bit
) -> (Bit, overflow: Bool) {