Flutter Engine
The Flutter Engine
SkSafeMath.cpp
Go to the documentation of this file.
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
9
10size_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
16size_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}
static size_t Add(size_t x, size_t y)
Definition: SkSafeMath.cpp:10
size_t add(size_t x, size_t y)
Definition: SkSafeMath.h:33
bool ok() const
Definition: SkSafeMath.h:26
static size_t Mul(size_t x, size_t y)
Definition: SkSafeMath.cpp:16
size_t mul(size_t x, size_t y)
Definition: SkSafeMath.h:29
double y
double x