| 235 | /// Signed subtraction with well-defined behaviour on overflow (as unsigned) |
| 236 | template <typename SignedInt> |
| 237 | SignedInt SafeSignedSubtract(SignedInt u, SignedInt v) { |
| 238 | using UnsignedInt = typename std::make_unsigned<SignedInt>::type; |
| 239 | return static_cast<SignedInt>(static_cast<UnsignedInt>(u) - |
| 240 | static_cast<UnsignedInt>(v)); |
| 241 | } |
| 242 | |
| 243 | /// Signed negation with well-defined behaviour on overflow (as unsigned) |
| 244 | template <typename SignedInt> |
no outgoing calls
no test coverage detected