1 // Copyright 2023 The Chromium Authors 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #ifndef PARTITION_ALLOC_SHIM_CHECKED_MULTIPLY_WIN_H_ 6 #define PARTITION_ALLOC_SHIM_CHECKED_MULTIPLY_WIN_H_ 7 8 #include "partition_alloc/partition_alloc_base/numerics/checked_math.h" 9 10 namespace allocator_shim::internal { 11 12 #if !defined(COMPONENT_BUILD) 13 PA_ALWAYS_INLINE 14 #endif CheckedMultiply(size_t multiplicand,size_t multiplier)15size_t CheckedMultiply(size_t multiplicand, size_t multiplier) { 16 partition_alloc::internal::base::CheckedNumeric<size_t> result = multiplicand; 17 result *= multiplier; 18 return result.ValueOrDie(); 19 } 20 21 } // namespace allocator_shim::internal 22 23 #endif // PARTITION_ALLOC_SHIM_CHECKED_MULTIPLY_WIN_H_ 24