MCPcopy Create free account
hub / github.com/Phobos-developers/Phobos / SafeMultiply

Method SafeMultiply

src/Utilities/GeneralUtils.cpp:297–307  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

295}
296
297int GeneralUtils::SafeMultiply(int value, int mult)
298{
299 long long product = static_cast<long long>(value) * mult;
300
301 if (product > INT32_MAX)
302 product = INT32_MAX;
303 else if (product < INT32_MIN)
304 product = INT32_MIN;
305
306 return static_cast<int>(product);
307}
308
309int GeneralUtils::SafeMultiply(int value, double mult)
310{

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected