diff options
author | Mike Reed <reed@google.com> | 2017-12-21 21:54:32 -0500 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-12-22 03:13:25 +0000 |
commit | 5c68dce7750a5525a5cfae29943716ce5c0d51b3 (patch) | |
tree | 1a3ba39a65deeb0c8b4d1c03722768a5f4830699 /src/core/SkSafeMath.h | |
parent | bdc453db784bd91e5cee55004075bb195ca7a743 (diff) |
add safemath version of readbuffer->skip
Bug: skia:
Change-Id: I6a5d24569cc1bd93bd190d81e3375993da9c56f0
Reviewed-on: https://skia-review.googlesource.com/88581
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Herb Derby <herb@google.com>
Reviewed-by: Mike Klein <mtklein@chromium.org>
Diffstat (limited to 'src/core/SkSafeMath.h')
-rw-r--r-- | src/core/SkSafeMath.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/core/SkSafeMath.h b/src/core/SkSafeMath.h index 1005d069a8..7afd482579 100644 --- a/src/core/SkSafeMath.h +++ b/src/core/SkSafeMath.h @@ -48,6 +48,10 @@ public: return add(x, alignment - 1) & ~(alignment - 1); } + // These saturate to their results + static size_t Add(size_t x, size_t y); + static size_t Mul(size_t x, size_t y); + private: uint32_t mul32(uint32_t x, uint32_t y) { uint64_t bx = x; |