Debian Codegraph @

src/base/SkSafeMath.cpp

raw
1 /*
2 * Copyright 2023 Google LLC
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8 #include "src/base/SkSafeMath.h"
9
10 size_t SkSafeMath::Add(size_t x, size_t y) {
11 SkSafeMath tmp;
12 size_t sum = tmp.add(x, y);
13 return tmp.ok() ? sum : SIZE_MAX;
14 }
15
16 size_t SkSafeMath::Mul(size_t x, size_t y) {
17 SkSafeMath tmp;
18 size_t prod = tmp.mul(x, y);
19 return tmp.ok() ? prod : SIZE_MAX;
20 }