Zeth - Zerocash on Ethereum  0.8
Reference implementation of the Zeth protocol by Clearmatics
safe_arithmetic.cpp
Go to the documentation of this file.
1 // Copyright (c) 2015-2022 Clearmatics Technologies Ltd
2 //
3 // SPDX-License-Identifier: LGPL-3.0+
4 
6 
7 namespace libzeth
8 {
9 
10 std::size_t subtract_with_clamp(std::size_t a, std::size_t b)
11 {
12  if (b > a) {
13  return 0;
14  }
15  return a - b;
16 };
17 
18 } // namespace libzeth
libzeth
Definition: binary_operation.hpp:15
libzeth::subtract_with_clamp
std::size_t subtract_with_clamp(std::size_t a, std::size_t b)
Definition: safe_arithmetic.cpp:10
safe_arithmetic.hpp