/* | |
* Copyright 2023 Google LLC | |
* | |
* Use of this source code is governed by a BSD-style license that can be | |
* found in the LICENSE file. | |
*/ | |
#include "src/base/SkSafeMath.h" | |
size_t SkSafeMath::Add(size_t x, size_t y) { | |
SkSafeMath tmp; | |
size_t sum = tmp.add(x, y); | |
return tmp.ok() ? sum : SIZE_MAX; | |
} | |
size_t SkSafeMath::Mul(size_t x, size_t y) { | |
SkSafeMath tmp; | |
size_t prod = tmp.mul(x, y); | |
return tmp.ok() ? prod : SIZE_MAX; | |
} |