Lines Matching refs:arg2
25 T SafeAdd(T arg1, T arg2) { in SafeAdd() argument
32 if ((arg1 >= 0 && arg2 <= std::numeric_limits<T>::max() - arg1) || in SafeAdd()
33 (arg1 < 0 && arg2 >= std::numeric_limits<T>::min() - arg1)) { in SafeAdd()
34 return arg1 + arg2; in SafeAdd()
45 T SafeUnsignedMult(T arg1, T arg2) { in SafeUnsignedMult() argument
46 if (arg1 == 0 || arg2 <= std::numeric_limits<T>::max() / arg1) { in SafeUnsignedMult()
47 return arg1 * arg2; in SafeUnsignedMult()
56 bool SafeInt32Add(std::int32_t arg1, std::int32_t arg2, std::int32_t *result) { in SafeInt32Add() argument
58 *result = SafeInt32Add(arg1, arg2); in SafeInt32Add()
65 std::int32_t SafeInt32Add(std::int32_t arg1, std::int32_t arg2) { in SafeInt32Add() argument
66 return SafeAdd<std::int32_t>(arg1, arg2); in SafeInt32Add()
69 std::int64_t SafeInt64Add(std::int64_t arg1, std::int64_t arg2) { in SafeInt64Add() argument
70 return SafeAdd<std::int64_t>(arg1, arg2); in SafeInt64Add()
73 bool SafeUint32Add(std::uint32_t arg1, std::uint32_t arg2, in SafeUint32Add() argument
76 *result = SafeUint32Add(arg1, arg2); in SafeUint32Add()
83 std::uint32_t SafeUint32Add(std::uint32_t arg1, std::uint32_t arg2) { in SafeUint32Add() argument
84 return SafeAdd<std::uint32_t>(arg1, arg2); in SafeUint32Add()
87 std::uint64_t SafeUint64Add(std::uint64_t arg1, std::uint64_t arg2) { in SafeUint64Add() argument
88 return SafeAdd<std::uint64_t>(arg1, arg2); in SafeUint64Add()
91 bool SafeInt32Sub(std::int32_t arg1, std::int32_t arg2, std::int32_t *result) { in SafeInt32Sub() argument
92 if ((arg2 >= 0 && arg1 >= std::numeric_limits<int32_t>::min() + arg2) || in SafeInt32Sub()
93 (arg2 < 0 && arg1 <= std::numeric_limits<int32_t>::max() + arg2)) { in SafeInt32Sub()
94 *result = arg1 - arg2; in SafeInt32Sub()
101 std::int32_t SafeInt32Sub(std::int32_t arg1, std::int32_t arg2) { in SafeInt32Sub() argument
104 if (!SafeInt32Sub(arg1, arg2, &result)) { in SafeInt32Sub()
111 std::uint32_t SafeUint32Sub(std::uint32_t arg1, std::uint32_t arg2) { in SafeUint32Sub() argument
112 if (arg1 >= arg2) { in SafeUint32Sub()
113 return arg1 - arg2; in SafeUint32Sub()
120 bool SafeUint32Mult(std::uint32_t arg1, std::uint32_t arg2, in SafeUint32Mult() argument
123 *result = SafeUint32Mult(arg1, arg2); in SafeUint32Mult()
130 bool SafeUint32Mult(std::uint32_t arg1, std::uint32_t arg2, std::uint32_t arg3, in SafeUint32Mult() argument
133 *result = SafeUint32Mult(arg1, arg2, arg3); in SafeUint32Mult()
140 bool SafeUint32Mult(std::uint32_t arg1, std::uint32_t arg2, std::uint32_t arg3, in SafeUint32Mult() argument
143 *result = SafeUint32Mult(arg1, arg2, arg3, arg4); in SafeUint32Mult()
150 std::uint32_t SafeUint32Mult(std::uint32_t arg1, std::uint32_t arg2) { in SafeUint32Mult() argument
151 return SafeUnsignedMult<std::uint32_t>(arg1, arg2); in SafeUint32Mult()
154 std::uint32_t SafeUint32Mult(std::uint32_t arg1, std::uint32_t arg2, in SafeUint32Mult() argument
156 return SafeUint32Mult(SafeUint32Mult(arg1, arg2), arg3); in SafeUint32Mult()
159 std::uint32_t SafeUint32Mult(std::uint32_t arg1, std::uint32_t arg2, in SafeUint32Mult() argument
161 return SafeUint32Mult(SafeUint32Mult(arg1, arg2, arg3), arg4); in SafeUint32Mult()
164 std::int32_t SafeInt32Mult(std::int32_t arg1, std::int32_t arg2) { in SafeInt32Mult() argument
166 static_cast<std::int64_t>(arg1) * static_cast<std::int64_t>(arg2); in SafeInt32Mult()
176 std::size_t SafeSizetMult(std::size_t arg1, std::size_t arg2) { in SafeSizetMult() argument
177 return SafeUnsignedMult<std::size_t>(arg1, arg2); in SafeSizetMult()
182 std::int64_t SafeInt64MultSlow(std::int64_t arg1, std::int64_t arg2) { in SafeInt64MultSlow() argument
186 if (arg2 > 0) { in SafeInt64MultSlow()
187 overflow = (arg1 > std::numeric_limits<std::int64_t>::max() / arg2); in SafeInt64MultSlow()
189 overflow = (arg2 < std::numeric_limits<std::int64_t>::min() / arg1); in SafeInt64MultSlow()
192 if (arg2 > 0) { in SafeInt64MultSlow()
193 overflow = (arg1 < std::numeric_limits<std::int64_t>::min() / arg2); in SafeInt64MultSlow()
196 arg2 < std::numeric_limits<std::int64_t>::max() / arg1); in SafeInt64MultSlow()
204 return arg1 * arg2; in SafeInt64MultSlow()
210 std::uint32_t SafeUint32DivideUp(std::uint32_t arg1, std::uint32_t arg2) { in SafeUint32DivideUp() argument
217 if (arg2 == 0) { in SafeUint32DivideUp()
225 return (arg1 - 1) / arg2 + 1; in SafeUint32DivideUp()