diff options
author | Florin Malita <fmalita@chromium.org> | 2017-11-22 10:11:12 -0500 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-11-22 18:54:14 +0000 |
commit | d923a71a113d97dc87b4424c25d5b5019331db24 (patch) | |
tree | 09921f16f2e08faf513fe4ddaed511d6051d9b2e /src/core/SkSafeMath.h | |
parent | d86a4f7c4a8f3cb08c88579f1f0d514a7bfc20af (diff) |
Use SkSafeMath for text blob storage calculations
Change-Id: I028895dee81d99b1fa2a9acfa3db3f4bcb0f8f64
Reviewed-on: https://skia-review.googlesource.com/73823
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
Diffstat (limited to 'src/core/SkSafeMath.h')
-rw-r--r-- | src/core/SkSafeMath.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/core/SkSafeMath.h b/src/core/SkSafeMath.h index f781c2cf21..1005d069a8 100644 --- a/src/core/SkSafeMath.h +++ b/src/core/SkSafeMath.h @@ -43,6 +43,11 @@ public: return a + b; } + size_t alignUp(size_t x, size_t alignment) { + SkASSERT(alignment && !(alignment & (alignment - 1))); + return add(x, alignment - 1) & ~(alignment - 1); + } + private: uint32_t mul32(uint32_t x, uint32_t y) { uint64_t bx = x; |