1 // Boost.Units - A C++ library for zero-overhead dimensional analysis and
2 // unit/quantity manipulation and conversion
4 // Copyright (C) 2014 Erik Erlandson
6 // Distributed under the Boost Software License, Version 1.0. (See
7 // accompanying file LICENSE_1_0.txt or copy at
8 // http://www.boost.org/LICENSE_1_0.txt)
10 #ifndef BOOST_UNITS_SYSTEMS_INFORMATION_PREFIXES_HPP_INCLUDED
11 #define BOOST_UNITS_SYSTEMS_INFORMATION_PREFIXES_HPP_INCLUDED
13 #include <boost/units/make_scaled_unit.hpp>
14 #include <boost/units/static_rational.hpp>
15 #include <boost/units/scale.hpp>
17 #include <boost/units/systems/information/byte.hpp>
19 #define BOOST_UNITS_INFOSYS_PREFIX(exponent, name) \
20 typedef make_scaled_unit<dimensionless, scale<2, static_rational<exponent> > >::type name ## _pf_type; \
21 BOOST_UNITS_STATIC_CONSTANT(name, name ## _pf_type)
25 namespace information {
27 // Note, these are defined (somewhat arbitrarily) against the 'byte' system.
28 // They work smoothly with bit_information, nat_information, etc, so it is
29 // transparent to the user.
30 BOOST_UNITS_INFOSYS_PREFIX(10, kibi);
31 BOOST_UNITS_INFOSYS_PREFIX(20, mebi);
32 BOOST_UNITS_INFOSYS_PREFIX(30, gibi);
33 BOOST_UNITS_INFOSYS_PREFIX(40, tebi);
34 BOOST_UNITS_INFOSYS_PREFIX(50, pebi);
35 BOOST_UNITS_INFOSYS_PREFIX(60, exbi);
36 BOOST_UNITS_INFOSYS_PREFIX(70, zebi);
37 BOOST_UNITS_INFOSYS_PREFIX(80, yobi);
39 } // namespace information
43 #undef BOOST_UNITS_INFOSYS_PREFIX
45 #endif // BOOST_UNITS_SYSTEMS_INFORMATION_PREFIXES_HPP_INCLUDED