GNU Radio Manual and C++ API Reference  v3.9.2.0-89-gb7c7001e
The Free & Open Software Radio Ecosystem
integer_math.h
Go to the documentation of this file.
1 /* -*- c++ -*- */
2 /*
3  * Copyright 2020 Free Software Foundation, Inc.
4  *
5  * This file is part of GNU Radio
6  *
7  * SPDX-License-Identifier: GPL-3.0-or-later
8  *
9  */
10 #ifndef INCLUDED_GR_INTEGER_MATH_H
11 #define INCLUDED_GR_INTEGER_MATH_H
12 
13 #if (__cplusplus >= 201703L)
14 
15 // Prefer C++17 goodness.
16 #include <numeric>
17 #define GR_GCD std::gcd
18 #define GR_LCM std::lcm
19 
20 #elif (BOOST_VERSION >= 105800)
21 
22 // Fallback: newer boost API (introduced in Boost 1.58.0).
23 #include <boost/integer/common_factor_rt.hpp>
24 #define GR_GCD boost::integer::gcd
25 #define GR_LCM boost::integer::lcm
26 
27 #else
28 
29 // Last resort: old deprecated boost API.
30 #include <boost/math/common_factor_rt.hpp>
31 #define GR_GCD boost::math::gcd
32 #define GR_LCM boost::math::lcm
33 
34 #endif /* __cplusplus >= 201703L */
35 #endif /* INCLUDED_GR_INTEGER_MATH_H */