chromium/third_party/ipcz/src/util/safe_math.h

// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef IPCZ_SRC_UTIL_SAFE_MATH_
#define IPCZ_SRC_UTIL_SAFE_MATH_

#include <limits>
#include <type_traits>

#include "third_party/abseil-cpp/absl/base/macros.h"
#include "third_party/abseil-cpp/absl/base/optimization.h"

namespace ipcz {

template <typename Dst, typename Src>
constexpr Dst checked_cast(Src value) {}

template <typename Dst, typename Src>
constexpr Dst saturated_cast(Src value) {}

template <typename T>
constexpr T CheckAdd(T a, T b) {}

template <typename T>
constexpr T CheckMul(T a, T b) {}

template <typename T>
T SaturatedAdd(T a, T b) {}

}  // namespace ipcz

#endif  // IPCZ_SRC_UTIL_SAFE_MATH_