MCPcopy Create free account
hub / github.com/Taywee/args / SafeAdd

Function SafeAdd

test_join_debug.cpp:10–21  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

8{
9 template<typename T>
10 bool SafeAdd(T a, T b, T& out)
11 {
12 if (std::is_unsigned<T>::value || true)
13 {
14 if (b > std::numeric_limits<T>::max() - a)
15 {
16 return false;
17 }
18 }
19 out = a + b;
20 return true;
21 }
22
23 template<typename T>
24 bool SafeMultiply(T a, T b, T& out)

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected