]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/multiprecision/performance/sf_performance.cpp
import new upstream nautilus stable release 14.2.8
[ceph.git] / ceph / src / boost / libs / multiprecision / performance / sf_performance.cpp
CommitLineData
7c673cae
FG
1///////////////////////////////////////////////////////////////
2// Copyright 2011 John Maddock. Distributed under the Boost
3// Software License, Version 1.0. (See accompanying file
92f5a8d4 4// LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt
7c673cae
FG
5
6#include "sf_performance.hpp"
7
8unsigned allocation_count = 0;
9
92f5a8d4
TL
10void* (*alloc_func_ptr)(size_t);
11void* (*realloc_func_ptr)(void*, size_t, size_t);
12void (*free_func_ptr)(void*, size_t);
7c673cae 13
92f5a8d4 14void* alloc_func(size_t n)
7c673cae
FG
15{
16 ++allocation_count;
17 return (*alloc_func_ptr)(n);
18}
19
92f5a8d4 20void free_func(void* p, size_t n)
7c673cae
FG
21{
22 (*free_func_ptr)(p, n);
23}
24
92f5a8d4 25void* realloc_func(void* p, size_t old, size_t n)
7c673cae
FG
26{
27 ++allocation_count;
28 return (*realloc_func_ptr)(p, old, n);
29}
30
31int main()
32{
33 using namespace boost::multiprecision;
34
35#if defined(TEST_MPFR) || defined(TEST_MPFR_CLASS) || defined(TEST_MPREAL) || defined(TEST_MPF)
36 mp_get_memory_functions(&alloc_func_ptr, &realloc_func_ptr, &free_func_ptr);
37 mp_set_memory_functions(&alloc_func, &realloc_func, &free_func);
38#endif
39
40 basic_tests();
41 bessel_tests();
42 poly_tests();
43 nct_tests();
44}