Chromium Code Reviews| Index: src/base/bits.h |
| diff --git a/src/base/bits.h b/src/base/bits.h |
| index 0e7662488428899bb8ca96677d873fcabac284db..2e6527b0548ec54f6640cc629d06c0a729959fe3 100644 |
| --- a/src/base/bits.h |
| +++ b/src/base/bits.h |
| @@ -16,6 +16,12 @@ |
| namespace v8 { |
| namespace base { |
| + |
| +namespace internal { |
|
jochen (gone - plz use gerrit)
2016/05/06 09:43:02
safe_math.h has using internal::CheckedNumeric in
lpy
2016/05/06 17:23:23
It's used in the declaration of FromCheckedNumeric
|
| +template <typename T> |
| +class CheckedNumeric; |
| +} |
| + |
| namespace bits { |
| // CountPopulation32(value) returns the number of bits set in |value|. |
| @@ -296,6 +302,21 @@ inline uint32_t UnsignedMod32(uint32_t lhs, uint32_t rhs) { |
| return rhs ? lhs % rhs : 0u; |
| } |
| + |
| +// Clamp |value| on overflow and underflow conditions. |
| +int64_t FromCheckedNumeric(const internal::CheckedNumeric<int64_t> value); |
| + |
| + |
| +// SignedSaturatedAdd64(lhs, rhs) adds |lhs| and |rhs|, |
| +// checks and returns the result. |
| +int64_t SignedSaturatedAdd64(int64_t lhs, int64_t rhs); |
| + |
| + |
| +// SignedSaturatedSub64(lhs, rhs) substracts |lhs| by |rhs|, |
| +// checks and returns the result. |
| +int64_t SignedSaturatedSub64(int64_t lhs, int64_t rhs); |
| + |
| + |
| } // namespace bits |
| } // namespace base |
| } // namespace v8 |