Initial Commit
This commit is contained in:
@@ -0,0 +1,159 @@
|
||||
// Copyright Vladimir Prus 2002-2004.
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt
|
||||
// or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
|
||||
#ifndef BOOST_CMDLINE_VP_2003_05_19
|
||||
#define BOOST_CMDLINE_VP_2003_05_19
|
||||
|
||||
#include <boost/program_options/config.hpp>
|
||||
#include <boost/program_options/errors.hpp>
|
||||
#include <boost/program_options/cmdline.hpp>
|
||||
#include <boost/program_options/option.hpp>
|
||||
#include <boost/program_options/options_description.hpp>
|
||||
#include <boost/program_options/positional_options.hpp>
|
||||
|
||||
|
||||
#include <boost/detail/workaround.hpp>
|
||||
|
||||
#include <boost/function.hpp>
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#if defined(BOOST_MSVC)
|
||||
# pragma warning (push)
|
||||
# pragma warning (disable:4251) // class 'std::vector<_Ty>' needs to have dll-interface to be used by clients of class 'boost::program_options::positional_options_description'
|
||||
#endif
|
||||
|
||||
namespace boost { namespace program_options { namespace detail {
|
||||
|
||||
/** Command line parser class. Main requirements were:
|
||||
- Powerful enough to support all common uses.
|
||||
- Simple and easy to learn/use.
|
||||
- Minimal code size and external dependencies.
|
||||
- Extensible for custom syntaxes.
|
||||
|
||||
First all options are registered. After that, elements of command line
|
||||
are extracted using operator++.
|
||||
|
||||
For each element, user can find
|
||||
- if it's an option or an argument
|
||||
- name of the option
|
||||
- index of the option
|
||||
- option value(s), if any
|
||||
|
||||
Sometimes the registered option name is not equal to the encountered
|
||||
one, for example, because name abbreviation is supported. Therefore
|
||||
two option names can be obtained:
|
||||
- the registered one
|
||||
- the one found at the command line
|
||||
|
||||
There are lot of style options, which can be used to tune the command
|
||||
line parsing. In addition, it's possible to install additional parser
|
||||
which will process custom option styles.
|
||||
|
||||
@todo mininal match length for guessing?
|
||||
*/
|
||||
class BOOST_PROGRAM_OPTIONS_DECL cmdline {
|
||||
public:
|
||||
|
||||
typedef ::boost::program_options::command_line_style::style_t style_t;
|
||||
|
||||
typedef function1<std::pair<std::string, std::string>,
|
||||
const std::string&>
|
||||
additional_parser;
|
||||
|
||||
typedef function1<std::vector<option>, std::vector<std::string>&>
|
||||
style_parser;
|
||||
|
||||
/** Constructs a command line parser for (argc, argv) pair. Uses
|
||||
style options passed in 'style', which should be binary or'ed values
|
||||
of style_t enum. It can also be zero, in which case a "default"
|
||||
style will be used. If 'allow_unregistered' is true, then allows
|
||||
unregistered options. They will be assigned index 1 and are
|
||||
assumed to have optional parameter.
|
||||
*/
|
||||
cmdline(const std::vector<std::string>& args);
|
||||
|
||||
/** @overload */
|
||||
cmdline(int argc, const char*const * argv);
|
||||
|
||||
void style(int style);
|
||||
|
||||
/** returns the canonical option prefix associated with the command_line_style
|
||||
* In order of precedence:
|
||||
* allow_long : allow_long
|
||||
* allow_long_disguise : allow_long_disguise
|
||||
* allow_dash_for_short : allow_short | allow_dash_for_short
|
||||
* allow_slash_for_short: allow_short | allow_slash_for_short
|
||||
*
|
||||
* This is mainly used for the diagnostic messages in exceptions
|
||||
*/
|
||||
int get_canonical_option_prefix();
|
||||
|
||||
void allow_unregistered();
|
||||
|
||||
void set_options_description(const options_description& desc);
|
||||
void set_positional_options(
|
||||
const positional_options_description& m_positional);
|
||||
|
||||
std::vector<option> run();
|
||||
|
||||
std::vector<option> parse_long_option(std::vector<std::string>& args);
|
||||
std::vector<option> parse_short_option(std::vector<std::string>& args);
|
||||
std::vector<option> parse_dos_option(std::vector<std::string>& args);
|
||||
std::vector<option> parse_disguised_long_option(
|
||||
std::vector<std::string>& args);
|
||||
std::vector<option> parse_terminator(
|
||||
std::vector<std::string>& args);
|
||||
std::vector<option> handle_additional_parser(
|
||||
std::vector<std::string>& args);
|
||||
|
||||
|
||||
/** Set additional parser. This will be called for each token
|
||||
of command line. If first string in pair is not empty,
|
||||
then the token is considered matched by this parser,
|
||||
and the first string will be considered an option name
|
||||
(which can be long or short), while the second will be
|
||||
option's parameter (if not empty).
|
||||
Note that additional parser can match only one token.
|
||||
*/
|
||||
void set_additional_parser(additional_parser p);
|
||||
|
||||
void extra_style_parser(style_parser s);
|
||||
|
||||
void check_style(int style) const;
|
||||
|
||||
bool is_style_active(style_t style) const;
|
||||
|
||||
void init(const std::vector<std::string>& args);
|
||||
|
||||
void
|
||||
finish_option(option& opt,
|
||||
std::vector<std::string>& other_tokens,
|
||||
const std::vector<style_parser>& style_parsers);
|
||||
|
||||
// Copies of input.
|
||||
std::vector<std::string> args;
|
||||
style_t m_style;
|
||||
bool m_allow_unregistered;
|
||||
|
||||
const options_description* m_desc;
|
||||
const positional_options_description* m_positional;
|
||||
|
||||
additional_parser m_additional_parser;
|
||||
style_parser m_style_parser;
|
||||
};
|
||||
|
||||
void test_cmdline_detail();
|
||||
|
||||
}}}
|
||||
|
||||
#if defined(BOOST_MSVC)
|
||||
# pragma warning (pop)
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
|
||||
#ifndef BOOST_MPL_FRONT_INSERTER_HPP_INCLUDED
|
||||
#define BOOST_MPL_FRONT_INSERTER_HPP_INCLUDED
|
||||
|
||||
// Copyright Aleksey Gurtovoy 2003-2004
|
||||
// Copyright David Abrahams 2003-2004
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// See http://www.boost.org/libs/mpl for documentation.
|
||||
|
||||
// $Id$
|
||||
// $Date$
|
||||
// $Revision$
|
||||
|
||||
#include <boost/mpl/push_front.hpp>
|
||||
#include <boost/mpl/inserter.hpp>
|
||||
|
||||
namespace boost { namespace mpl {
|
||||
|
||||
template<
|
||||
typename Sequence
|
||||
>
|
||||
struct front_inserter
|
||||
: inserter< Sequence,push_front<> >
|
||||
{
|
||||
};
|
||||
|
||||
}}
|
||||
|
||||
#endif // BOOST_MPL_FRONT_INSERTER_HPP_INCLUDED
|
||||
@@ -0,0 +1,91 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2003 Jonathan de Halleux (dehalleux@pelikhan.com)
|
||||
http://spirit.sourceforge.net/
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
=============================================================================*/
|
||||
#ifndef BOOST_SPIRIT_ACTOR_PUSH_FRONT_ACTOR_HPP
|
||||
#define BOOST_SPIRIT_ACTOR_PUSH_FRONT_ACTOR_HPP
|
||||
|
||||
#include <boost/spirit/home/classic/namespace.hpp>
|
||||
#include <boost/spirit/home/classic/actor/ref_value_actor.hpp>
|
||||
#include <boost/spirit/home/classic/actor/ref_const_ref_actor.hpp>
|
||||
|
||||
namespace boost { namespace spirit {
|
||||
|
||||
BOOST_SPIRIT_CLASSIC_NAMESPACE_BEGIN
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// Summary:
|
||||
//
|
||||
// A semantic action policy that appends a value to the front of a
|
||||
// container.
|
||||
// (This doc uses convention available in actors.hpp)
|
||||
//
|
||||
// Actions (what it does and what ref, value_ref must support):
|
||||
// ref.push_front( value );
|
||||
// ref.push_front( T::value_type(first,last) );
|
||||
// ref.push_front( value_ref );
|
||||
//
|
||||
// Policy name:
|
||||
// push_front_action
|
||||
//
|
||||
// Policy holder, corresponding helper method:
|
||||
// ref_value_actor, push_front_a( ref );
|
||||
// ref_const_ref_actor, push_front_a( ref, value_ref );
|
||||
//
|
||||
// () operators: both
|
||||
//
|
||||
// See also ref_value_actor and ref_const_ref_actor for more details.
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
struct push_front_action
|
||||
{
|
||||
template<
|
||||
typename T,
|
||||
typename ValueT
|
||||
>
|
||||
void act(T& ref_, ValueT const& value_) const
|
||||
{
|
||||
ref_.push_front( value_ );
|
||||
}
|
||||
template<
|
||||
typename T,
|
||||
typename IteratorT
|
||||
>
|
||||
void act(
|
||||
T& ref_,
|
||||
IteratorT const& first_,
|
||||
IteratorT const& last_
|
||||
) const
|
||||
{
|
||||
typedef typename T::value_type value_type;
|
||||
value_type value(first_,last_);
|
||||
|
||||
ref_.push_front( value );
|
||||
}
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
inline ref_value_actor<T,push_front_action> push_front_a(T& ref_)
|
||||
{
|
||||
return ref_value_actor<T,push_front_action>(ref_);
|
||||
}
|
||||
|
||||
template<
|
||||
typename T,
|
||||
typename ValueT
|
||||
>
|
||||
inline ref_const_ref_actor<T,ValueT,push_front_action> push_front_a(
|
||||
T& ref_,
|
||||
ValueT const& value_
|
||||
)
|
||||
{
|
||||
return ref_const_ref_actor<T,ValueT,push_front_action>(ref_,value_);
|
||||
}
|
||||
|
||||
BOOST_SPIRIT_CLASSIC_NAMESPACE_END
|
||||
|
||||
}}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,53 @@
|
||||
# /* Copyright (C) 2001
|
||||
# * Housemarque Oy
|
||||
# * http://www.housemarque.com
|
||||
# *
|
||||
# * Distributed under the Boost Software License, Version 1.0. (See
|
||||
# * accompanying file LICENSE_1_0.txt or copy at
|
||||
# * http://www.boost.org/LICENSE_1_0.txt)
|
||||
# */
|
||||
#
|
||||
# /* Revised by Paul Mensonides (2002) */
|
||||
#
|
||||
# /* See http://www.boost.org for most recent version. */
|
||||
#
|
||||
# ifndef BOOST_PREPROCESSOR_ARITHMETIC_MUL_HPP
|
||||
# define BOOST_PREPROCESSOR_ARITHMETIC_MUL_HPP
|
||||
#
|
||||
# include <boost/preprocessor/arithmetic/add.hpp>
|
||||
# include <boost/preprocessor/arithmetic/dec.hpp>
|
||||
# include <boost/preprocessor/config/config.hpp>
|
||||
# include <boost/preprocessor/control/while.hpp>
|
||||
# include <boost/preprocessor/tuple/elem.hpp>
|
||||
# include <boost/preprocessor/tuple/rem.hpp>
|
||||
#
|
||||
# /* BOOST_PP_MUL */
|
||||
#
|
||||
# if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_EDG()
|
||||
# define BOOST_PP_MUL(x, y) BOOST_PP_TUPLE_ELEM(3, 0, BOOST_PP_WHILE(BOOST_PP_MUL_P, BOOST_PP_MUL_O, (0, x, y)))
|
||||
# else
|
||||
# define BOOST_PP_MUL(x, y) BOOST_PP_MUL_I(x, y)
|
||||
# define BOOST_PP_MUL_I(x, y) BOOST_PP_TUPLE_ELEM(3, 0, BOOST_PP_WHILE(BOOST_PP_MUL_P, BOOST_PP_MUL_O, (0, x, y)))
|
||||
# endif
|
||||
#
|
||||
# define BOOST_PP_MUL_P(d, rxy) BOOST_PP_TUPLE_ELEM(3, 2, rxy)
|
||||
#
|
||||
# if BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_STRICT()
|
||||
# define BOOST_PP_MUL_O(d, rxy) BOOST_PP_MUL_O_IM(d, BOOST_PP_TUPLE_REM_3 rxy)
|
||||
# define BOOST_PP_MUL_O_IM(d, im) BOOST_PP_MUL_O_I(d, im)
|
||||
# else
|
||||
# define BOOST_PP_MUL_O(d, rxy) BOOST_PP_MUL_O_I(d, BOOST_PP_TUPLE_ELEM(3, 0, rxy), BOOST_PP_TUPLE_ELEM(3, 1, rxy), BOOST_PP_TUPLE_ELEM(3, 2, rxy))
|
||||
# endif
|
||||
#
|
||||
# define BOOST_PP_MUL_O_I(d, r, x, y) (BOOST_PP_ADD_D(d, r, x), x, BOOST_PP_DEC(y))
|
||||
#
|
||||
# /* BOOST_PP_MUL_D */
|
||||
#
|
||||
# if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_EDG()
|
||||
# define BOOST_PP_MUL_D(d, x, y) BOOST_PP_TUPLE_ELEM(3, 0, BOOST_PP_WHILE_ ## d(BOOST_PP_MUL_P, BOOST_PP_MUL_O, (0, x, y)))
|
||||
# else
|
||||
# define BOOST_PP_MUL_D(d, x, y) BOOST_PP_MUL_D_I(d, x, y)
|
||||
# define BOOST_PP_MUL_D_I(d, x, y) BOOST_PP_TUPLE_ELEM(3, 0, BOOST_PP_WHILE_ ## d(BOOST_PP_MUL_P, BOOST_PP_MUL_O, (0, x, y)))
|
||||
# endif
|
||||
#
|
||||
# endif
|
||||
@@ -0,0 +1,48 @@
|
||||
|
||||
// (C) Copyright Tobias Schwinger
|
||||
//
|
||||
// Use modification and distribution are subject to the boost Software License,
|
||||
// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt).
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
#ifndef BOOST_FT_RESULT_TYPE_HPP_INCLUDED
|
||||
#define BOOST_FT_RESULT_TYPE_HPP_INCLUDED
|
||||
|
||||
#include <boost/blank.hpp>
|
||||
#include <boost/mpl/if.hpp>
|
||||
|
||||
#include <boost/mpl/aux_/lambda_support.hpp>
|
||||
|
||||
#include <boost/mpl/at.hpp>
|
||||
|
||||
#include <boost/function_types/is_callable_builtin.hpp>
|
||||
#include <boost/function_types/components.hpp>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
namespace function_types
|
||||
{
|
||||
template< typename T > struct result_type;
|
||||
|
||||
namespace detail
|
||||
{
|
||||
template<typename T> struct result_type_impl
|
||||
: mpl::at_c
|
||||
< typename function_types::components<T>::types, 0 >
|
||||
{ };
|
||||
}
|
||||
|
||||
template<typename T> struct result_type
|
||||
: mpl::if_
|
||||
< function_types::is_callable_builtin<T>
|
||||
, detail::result_type_impl<T>, boost::blank
|
||||
>::type
|
||||
{
|
||||
BOOST_MPL_AUX_LAMBDA_SUPPORT(1,result_type,(T))
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
// Boost.Units - A C++ library for zero-overhead dimensional analysis and
|
||||
// unit/quantity manipulation and conversion
|
||||
//
|
||||
// Copyright (C) 2003-2008 Matthias Christian Schabel
|
||||
// Copyright (C) 2008 Steven Watanabe
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See
|
||||
// accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#ifndef BOOST_UNITS_IS_DIMENSION_LIST_HPP
|
||||
#define BOOST_UNITS_IS_DIMENSION_LIST_HPP
|
||||
|
||||
///
|
||||
/// \file
|
||||
/// \brief Check that a type is a valid dimension list.
|
||||
///
|
||||
|
||||
#include <boost/mpl/bool.hpp>
|
||||
|
||||
#include <boost/units/units_fwd.hpp>
|
||||
|
||||
namespace boost {
|
||||
|
||||
namespace units {
|
||||
|
||||
/// Check that a type is a valid dimension list.
|
||||
template<typename Seq>
|
||||
struct is_dimension_list :
|
||||
public mpl::false_
|
||||
{ };
|
||||
|
||||
template<typename Item, typename Next>
|
||||
struct is_dimension_list<list<Item, Next> > :
|
||||
public mpl::true_
|
||||
{ };
|
||||
|
||||
template<>
|
||||
struct is_dimension_list<dimensionless_type> :
|
||||
public mpl::true_
|
||||
{ };
|
||||
|
||||
} // namespace units
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#endif // BOOST_UNITS_IS_DIMENSION_LIST_HPP
|
||||
@@ -0,0 +1,38 @@
|
||||
# /* **************************************************************************
|
||||
# * *
|
||||
# * (C) Copyright Paul Mensonides 2002.
|
||||
# * Distributed under the Boost Software License, Version 1.0. (See
|
||||
# * accompanying file LICENSE_1_0.txt or copy at
|
||||
# * http://www.boost.org/LICENSE_1_0.txt)
|
||||
# * *
|
||||
# ************************************************************************** */
|
||||
#
|
||||
# /* See http://www.boost.org for most recent version. */
|
||||
#
|
||||
# ifndef BOOST_PREPROCESSOR_PUNCTUATION_PAREN_IF_HPP
|
||||
# define BOOST_PREPROCESSOR_PUNCTUATION_PAREN_IF_HPP
|
||||
#
|
||||
# include <boost/preprocessor/config/config.hpp>
|
||||
# include <boost/preprocessor/control/if.hpp>
|
||||
# include <boost/preprocessor/facilities/empty.hpp>
|
||||
# include <boost/preprocessor/punctuation/paren.hpp>
|
||||
#
|
||||
# /* BOOST_PP_LPAREN_IF */
|
||||
#
|
||||
# if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_EDG()
|
||||
# define BOOST_PP_LPAREN_IF(cond) BOOST_PP_IF(cond, BOOST_PP_LPAREN, BOOST_PP_EMPTY)()
|
||||
# else
|
||||
# define BOOST_PP_LPAREN_IF(cond) BOOST_PP_LPAREN_IF_I(cond)
|
||||
# define BOOST_PP_LPAREN_IF_I(cond) BOOST_PP_IF(cond, BOOST_PP_LPAREN, BOOST_PP_EMPTY)()
|
||||
# endif
|
||||
#
|
||||
# /* BOOST_PP_RPAREN_IF */
|
||||
#
|
||||
# if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_EDG()
|
||||
# define BOOST_PP_RPAREN_IF(cond) BOOST_PP_IF(cond, BOOST_PP_RPAREN, BOOST_PP_EMPTY)()
|
||||
# else
|
||||
# define BOOST_PP_RPAREN_IF(cond) BOOST_PP_RPAREN_IF_I(cond)
|
||||
# define BOOST_PP_RPAREN_IF_I(cond) BOOST_PP_IF(cond, BOOST_PP_RPAREN, BOOST_PP_EMPTY)()
|
||||
# endif
|
||||
#
|
||||
# endif
|
||||
@@ -0,0 +1,64 @@
|
||||
#if !defined(BOOST_PROTO_DONT_USE_PREPROCESSED_FILES)
|
||||
|
||||
#include <boost/proto/detail/preprocessed/deduce_domain_n.hpp>
|
||||
|
||||
#elif !defined(BOOST_PP_IS_ITERATING)
|
||||
|
||||
#define BOOST_PROTO_COMMON_DOMAIN2(Z, N, DATA) \
|
||||
typedef \
|
||||
typename common_domain2<common ## N, A ## N>::type \
|
||||
BOOST_PP_CAT(common, BOOST_PP_INC(N)); \
|
||||
/**/
|
||||
|
||||
#if defined(__WAVE__) && defined(BOOST_PROTO_CREATE_PREPROCESSED_FILES)
|
||||
#pragma wave option(preserve: 2, line: 0, output: "preprocessed/deduce_domain_n.hpp")
|
||||
#endif
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// deduce_domain_n.hpp
|
||||
// Definitions of common_domain[n] and deduce_domain[n] class templates.
|
||||
//
|
||||
// Copyright 2008 Eric Niebler. Distributed under the Boost
|
||||
// Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#if defined(__WAVE__) && defined(BOOST_PROTO_CREATE_PREPROCESSED_FILES)
|
||||
#pragma wave option(preserve: 1)
|
||||
#endif
|
||||
|
||||
#define BOOST_PP_ITERATION_PARAMS_1 \
|
||||
(3, (3, BOOST_PROTO_MAX_ARITY, <boost/proto/detail/deduce_domain_n.hpp>))
|
||||
#include BOOST_PP_ITERATE()
|
||||
|
||||
#if defined(__WAVE__) && defined(BOOST_PROTO_CREATE_PREPROCESSED_FILES)
|
||||
#pragma wave option(output: null)
|
||||
#endif
|
||||
|
||||
#undef BOOST_PROTO_COMMON_DOMAIN2
|
||||
|
||||
#else
|
||||
|
||||
#define N BOOST_PP_ITERATION()
|
||||
|
||||
template<BOOST_PP_ENUM_PARAMS(N, typename A)>
|
||||
struct BOOST_PP_CAT(common_domain, N)
|
||||
{
|
||||
typedef A0 common1;
|
||||
BOOST_PP_REPEAT_FROM_TO(1, N, BOOST_PROTO_COMMON_DOMAIN2, ~)
|
||||
typedef BOOST_PP_CAT(common, N) type;
|
||||
BOOST_PROTO_ASSERT_VALID_DOMAIN(type);
|
||||
};
|
||||
|
||||
template<BOOST_PP_ENUM_PARAMS(N, typename E)>
|
||||
struct BOOST_PP_CAT(deduce_domain, N)
|
||||
: BOOST_PP_CAT(common_domain, N)<
|
||||
BOOST_PP_ENUM_BINARY_PARAMS(
|
||||
N
|
||||
, typename domain_of<E, >::type BOOST_PP_INTERCEPT
|
||||
)
|
||||
>
|
||||
{};
|
||||
|
||||
#undef N
|
||||
|
||||
#endif // BOOST_PROTO_DONT_USE_PREPROCESSED_FILES
|
||||
@@ -0,0 +1,65 @@
|
||||
#ifndef POSIX_PTIME_HPP___
|
||||
#define POSIX_PTIME_HPP___
|
||||
|
||||
/* Copyright (c) 2002,2003 CrystalClear Software, Inc.
|
||||
* Use, modification and distribution is subject to the
|
||||
* Boost Software License, Version 1.0. (See accompanying
|
||||
* file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
|
||||
* Author: Jeff Garland
|
||||
* $Date$
|
||||
*/
|
||||
|
||||
#include "boost/date_time/posix_time/posix_time_system.hpp"
|
||||
#include "boost/date_time/time.hpp"
|
||||
|
||||
namespace boost {
|
||||
|
||||
namespace posix_time {
|
||||
|
||||
//bring special enum values into the namespace
|
||||
using date_time::special_values;
|
||||
using date_time::not_special;
|
||||
using date_time::neg_infin;
|
||||
using date_time::pos_infin;
|
||||
using date_time::not_a_date_time;
|
||||
using date_time::max_date_time;
|
||||
using date_time::min_date_time;
|
||||
|
||||
//! Time type with no timezone or other adjustments
|
||||
/*! \ingroup time_basics
|
||||
*/
|
||||
class ptime : public date_time::base_time<ptime, posix_time_system>
|
||||
{
|
||||
public:
|
||||
typedef posix_time_system time_system_type;
|
||||
typedef time_system_type::time_rep_type time_rep_type;
|
||||
typedef time_system_type::time_duration_type time_duration_type;
|
||||
typedef ptime time_type;
|
||||
//! Construct with date and offset in day
|
||||
ptime(gregorian::date d,time_duration_type td) : date_time::base_time<time_type,time_system_type>(d,td)
|
||||
{}
|
||||
//! Construct a time at start of the given day (midnight)
|
||||
explicit ptime(gregorian::date d) : date_time::base_time<time_type,time_system_type>(d,time_duration_type(0,0,0))
|
||||
{}
|
||||
//! Copy from time_rep
|
||||
ptime(const time_rep_type& rhs):
|
||||
date_time::base_time<time_type,time_system_type>(rhs)
|
||||
{}
|
||||
//! Construct from special value
|
||||
ptime(const special_values sv) : date_time::base_time<time_type,time_system_type>(sv)
|
||||
{}
|
||||
#if !defined(DATE_TIME_NO_DEFAULT_CONSTRUCTOR)
|
||||
// Default constructor constructs to not_a_date_time
|
||||
ptime() : date_time::base_time<time_type,time_system_type>(gregorian::date(not_a_date_time), time_duration_type(not_a_date_time))
|
||||
{}
|
||||
#endif // DATE_TIME_NO_DEFAULT_CONSTRUCTOR
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
} }//namespace posix_time
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,79 @@
|
||||
// Boost.Range library
|
||||
//
|
||||
// Copyright Thorsten Ottosen 2003-2004. Use, modification and
|
||||
// distribution is subject to the Boost Software License, Version
|
||||
// 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// For more information, see http://www.boost.org/libs/range/
|
||||
//
|
||||
|
||||
#ifndef BOOST_RANGE_MUTABLE_ITERATOR_HPP
|
||||
#define BOOST_RANGE_MUTABLE_ITERATOR_HPP
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
#include <boost/range/config.hpp>
|
||||
|
||||
#include <boost/range/range_fwd.hpp>
|
||||
#include <boost/range/detail/extract_optional_type.hpp>
|
||||
#include <boost/type_traits/remove_reference.hpp>
|
||||
#include <boost/iterator/iterator_traits.hpp>
|
||||
#include <cstddef>
|
||||
#include <utility>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// default
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
namespace range_detail
|
||||
{
|
||||
|
||||
BOOST_RANGE_EXTRACT_OPTIONAL_TYPE( iterator )
|
||||
|
||||
template< typename C >
|
||||
struct range_mutable_iterator
|
||||
: range_detail::extract_iterator<
|
||||
BOOST_DEDUCED_TYPENAME remove_reference<C>::type>
|
||||
{};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// pair
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
template< typename Iterator >
|
||||
struct range_mutable_iterator< std::pair<Iterator,Iterator> >
|
||||
{
|
||||
typedef Iterator type;
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// array
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
template< typename T, std::size_t sz >
|
||||
struct range_mutable_iterator< T[sz] >
|
||||
{
|
||||
typedef T* type;
|
||||
};
|
||||
|
||||
} // namespace range_detail
|
||||
|
||||
template<typename C, typename Enabler=void>
|
||||
struct range_mutable_iterator
|
||||
: range_detail::range_mutable_iterator<
|
||||
BOOST_DEDUCED_TYPENAME remove_reference<C>::type
|
||||
>
|
||||
{
|
||||
};
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#include <boost/range/detail/msvc_has_iterator_workaround.hpp>
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,51 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// foreach.hpp header file
|
||||
//
|
||||
// Copyright 2010 Eric Niebler.
|
||||
// Distributed under the Boost Software License, Version 1.0. (See
|
||||
// accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
// See http://www.boost.org/libs/foreach for documentation
|
||||
//
|
||||
// Credits:
|
||||
// Kazutoshi Satoda: for suggesting the need for a _fwd header for foreach's
|
||||
// customization points.
|
||||
|
||||
#ifndef BOOST_FOREACH_FWD_HPP
|
||||
#define BOOST_FOREACH_FWD_HPP
|
||||
|
||||
// This must be at global scope, hence the uglified name
|
||||
enum boost_foreach_argument_dependent_lookup_hack
|
||||
{
|
||||
boost_foreach_argument_dependent_lookup_hack_value
|
||||
};
|
||||
|
||||
namespace boost
|
||||
{
|
||||
|
||||
namespace foreach
|
||||
{
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// boost::foreach::tag
|
||||
//
|
||||
typedef boost_foreach_argument_dependent_lookup_hack tag;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// boost::foreach::is_lightweight_proxy
|
||||
// Specialize this for user-defined collection types if they are inexpensive to copy.
|
||||
// This tells BOOST_FOREACH it can avoid the rvalue/lvalue detection stuff.
|
||||
template<typename T>
|
||||
struct is_lightweight_proxy;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// boost::foreach::is_noncopyable
|
||||
// Specialize this for user-defined collection types if they cannot be copied.
|
||||
// This also tells BOOST_FOREACH to avoid the rvalue/lvalue detection stuff.
|
||||
template<typename T>
|
||||
struct is_noncopyable;
|
||||
|
||||
} // namespace foreach
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,17 @@
|
||||
# /* **************************************************************************
|
||||
# * *
|
||||
# * (C) Copyright Paul Mensonides 2002.
|
||||
# * Distributed under the Boost Software License, Version 1.0. (See
|
||||
# * accompanying file LICENSE_1_0.txt or copy at
|
||||
# * http://www.boost.org/LICENSE_1_0.txt)
|
||||
# * *
|
||||
# ************************************************************************** */
|
||||
#
|
||||
# /* See http://www.boost.org for most recent version. */
|
||||
#
|
||||
# ifndef BOOST_PREPROCESSOR_EXPR_IF_HPP
|
||||
# define BOOST_PREPROCESSOR_EXPR_IF_HPP
|
||||
#
|
||||
# include <boost/preprocessor/control/expr_if.hpp>
|
||||
#
|
||||
# endif
|
||||
@@ -0,0 +1,154 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2003 Joel de Guzman
|
||||
Copyright (c) 2002-2003 Hartmut Kaiser
|
||||
http://spirit.sourceforge.net/
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
=============================================================================*/
|
||||
#if !defined(BOOST_SPIRIT_DEBUG_MAIN_HPP)
|
||||
#define BOOST_SPIRIT_DEBUG_MAIN_HPP
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
#if defined(BOOST_SPIRIT_DEBUG)
|
||||
|
||||
#include <boost/spirit/home/classic/version.hpp>
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Spirit.Debug includes and defines
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <iostream>
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// The BOOST_SPIRIT_DEBUG_OUT defines the stream object, which should be used
|
||||
// for debug diagnostics. This defaults to std::cout.
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
#if !defined(BOOST_SPIRIT_DEBUG_OUT)
|
||||
#define BOOST_SPIRIT_DEBUG_OUT std::cout
|
||||
#endif
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// The BOOST_SPIRIT_DEBUG_PRINT_SOME constant defines the number of characters
|
||||
// from the stream to be printed for diagnosis. This defaults to the first
|
||||
// 20 characters.
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
#if !defined(BOOST_SPIRIT_DEBUG_PRINT_SOME)
|
||||
#define BOOST_SPIRIT_DEBUG_PRINT_SOME 20
|
||||
#endif
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Additional BOOST_SPIRIT_DEBUG_FLAGS control the level of diagnostics printed
|
||||
// Basic constants are defined in debug/minimal.hpp.
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
#define BOOST_SPIRIT_DEBUG_FLAGS_NODES 0x0001 // node diagnostics
|
||||
#define BOOST_SPIRIT_DEBUG_FLAGS_ESCAPE_CHAR 0x0002 // escape_char_parse diagnostics
|
||||
#define BOOST_SPIRIT_DEBUG_FLAGS_TREES 0x0004 // parse tree/ast diagnostics
|
||||
#define BOOST_SPIRIT_DEBUG_FLAGS_CLOSURES 0x0008 // closure diagnostics
|
||||
#define BOOST_SPIRIT_DEBUG_FLAGS_SLEX 0x8000 // slex diagnostics
|
||||
|
||||
#define BOOST_SPIRIT_DEBUG_FLAGS_MAX 0xFFFF // print maximal diagnostics
|
||||
|
||||
#if !defined(BOOST_SPIRIT_DEBUG_FLAGS)
|
||||
#define BOOST_SPIRIT_DEBUG_FLAGS BOOST_SPIRIT_DEBUG_FLAGS_MAX
|
||||
#endif
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// By default all nodes are traced (even those, not registered with
|
||||
// BOOST_SPIRIT_DEBUG_RULE et.al. - see below). The following constant may be
|
||||
// used to redefine this default.
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
#if !defined(BOOST_SPIRIT_DEBUG_TRACENODE)
|
||||
#define BOOST_SPIRIT_DEBUG_TRACENODE (true)
|
||||
#endif // !defined(BOOST_SPIRIT_DEBUG_TRACENODE)
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Helper macros for giving rules and subrules a name accessible through
|
||||
// parser_name() functions (see parser_names.hpp).
|
||||
//
|
||||
// Additionally, the macros BOOST_SPIRIT_DEBUG_RULE, SPIRIT_DEBUG_NODE and
|
||||
// BOOST_SPIRIT_DEBUG_GRAMMAR enable/disable the tracing of the
|
||||
// correspondingnode accordingly to the PP constant
|
||||
// BOOST_SPIRIT_DEBUG_TRACENODE.
|
||||
//
|
||||
// The macros BOOST_SPIRIT_DEBUG_TRACE_RULE, BOOST_SPIRIT_DEBUG_TRACE_NODE
|
||||
// and BOOST_SPIRIT_DEBUG_TRACE_GRAMMAR allow to specify a flag to define,
|
||||
// whether the corresponding node is to be traced or not.
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
#if !defined(BOOST_SPIRIT_DEBUG_RULE)
|
||||
#define BOOST_SPIRIT_DEBUG_RULE(r) \
|
||||
::BOOST_SPIRIT_CLASSIC_NS::impl::get_node_registry(). \
|
||||
register_node(&r, #r, BOOST_SPIRIT_DEBUG_TRACENODE)
|
||||
#endif // !defined(BOOST_SPIRIT_DEBUG_RULE)
|
||||
|
||||
#if !defined(BOOST_SPIRIT_DEBUG_NODE)
|
||||
#define BOOST_SPIRIT_DEBUG_NODE(r) \
|
||||
::BOOST_SPIRIT_CLASSIC_NS::impl::get_node_registry(). \
|
||||
register_node(&r, #r, BOOST_SPIRIT_DEBUG_TRACENODE)
|
||||
#endif // !defined(BOOST_SPIRIT_DEBUG_NODE)
|
||||
|
||||
#if !defined(BOOST_SPIRIT_DEBUG_GRAMMAR)
|
||||
#define BOOST_SPIRIT_DEBUG_GRAMMAR(r) \
|
||||
::BOOST_SPIRIT_CLASSIC_NS::impl::get_node_registry(). \
|
||||
register_node(&r, #r, BOOST_SPIRIT_DEBUG_TRACENODE)
|
||||
#endif // !defined(BOOST_SPIRIT_DEBUG_GRAMMAR)
|
||||
|
||||
#if !defined(BOOST_SPIRIT_DEBUG_TRACE_RULE)
|
||||
#define BOOST_SPIRIT_DEBUG_TRACE_RULE(r, t) \
|
||||
::BOOST_SPIRIT_CLASSIC_NS::impl::get_node_registry(). \
|
||||
register_node(&r, #r, (t))
|
||||
#endif // !defined(BOOST_SPIRIT_TRACE_RULE)
|
||||
|
||||
#if !defined(BOOST_SPIRIT_DEBUG_TRACE_NODE)
|
||||
#define BOOST_SPIRIT_DEBUG_TRACE_NODE(r, t) \
|
||||
::BOOST_SPIRIT_CLASSIC_NS::impl::get_node_registry(). \
|
||||
register_node(&r, #r, (t))
|
||||
#endif // !defined(BOOST_SPIRIT_DEBUG_TRACE_NODE)
|
||||
|
||||
#if !defined(BOOST_SPIRIT_DEBUG_TRACE_GRAMMAR)
|
||||
#define BOOST_SPIRIT_DEBUG_TRACE_GRAMMAR(r, t) \
|
||||
::BOOST_SPIRIT_CLASSIC_NS::impl::get_node_registry(). \
|
||||
register_node(&r, #r, (t))
|
||||
#endif // !defined(BOOST_SPIRIT_DEBUG_TRACE_GRAMMAR)
|
||||
|
||||
#if !defined(BOOST_SPIRIT_DEBUG_TRACE_RULE_NAME)
|
||||
#define BOOST_SPIRIT_DEBUG_TRACE_RULE_NAME(r, n, t) \
|
||||
::BOOST_SPIRIT_CLASSIC_NS::impl::get_node_registry(). \
|
||||
register_node(&r, (n), (t))
|
||||
#endif // !defined(BOOST_SPIRIT_DEBUG_TRACE_RULE_NAME)
|
||||
|
||||
#if !defined(BOOST_SPIRIT_DEBUG_TRACE_NODE_NAME)
|
||||
#define BOOST_SPIRIT_DEBUG_TRACE_NODE_NAME(r, n, t) \
|
||||
::BOOST_SPIRIT_CLASSIC_NS::impl::get_node_registry(). \
|
||||
register_node(&r, (n), (t))
|
||||
#endif // !defined(BOOST_SPIRIT_DEBUG_TRACE_NODE_NAME)
|
||||
|
||||
#if !defined(BOOST_SPIRIT_DEBUG_TRACE_GRAMMAR_NAME)
|
||||
#define BOOST_SPIRIT_DEBUG_TRACE_GRAMMAR_NAME(r, n, t) \
|
||||
::BOOST_SPIRIT_CLASSIC_NS::impl::get_node_registry(). \
|
||||
register_node(&r, (n), (t))
|
||||
#endif // !defined(BOOST_SPIRIT_DEBUG_TRACE_GRAMMAR_NAME)
|
||||
|
||||
//////////////////////////////////
|
||||
#include <boost/spirit/home/classic/debug/debug_node.hpp>
|
||||
|
||||
#else
|
||||
//////////////////////////////////
|
||||
#include <boost/spirit/home/classic/debug/minimal.hpp>
|
||||
|
||||
#endif // BOOST_SPIRIT_DEBUG
|
||||
|
||||
#endif
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,38 @@
|
||||
// Copyright Neil Groves 2009. Use, modification and
|
||||
// distribution is subject to the Boost Software License, Version
|
||||
// 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
//
|
||||
// For more information, see http://www.boost.org/libs/range/
|
||||
//
|
||||
#ifndef BOOST_RANGE_ALGORITHM_REMOVE_COPY_IF_HPP_INCLUDED
|
||||
#define BOOST_RANGE_ALGORITHM_REMOVE_COPY_IF_HPP_INCLUDED
|
||||
|
||||
#include <boost/concept_check.hpp>
|
||||
#include <boost/range/begin.hpp>
|
||||
#include <boost/range/end.hpp>
|
||||
#include <boost/range/concepts.hpp>
|
||||
#include <algorithm>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
/// \brief template function remove_copy_if
|
||||
///
|
||||
/// range-based version of the remove_copy_if std algorithm
|
||||
///
|
||||
/// \pre SinglePassRange is a model of the SinglePassRangeConcept
|
||||
/// \pre OutputIterator is a model of the OutputIteratorConcept
|
||||
/// \pre Predicate is a model of the PredicateConcept
|
||||
/// \pre InputIterator's value type is convertible to Predicate's argument type
|
||||
/// \pre out_it is not an iterator in the range rng
|
||||
template< class SinglePassRange, class OutputIterator, class Predicate >
|
||||
inline OutputIterator
|
||||
remove_copy_if(const SinglePassRange& rng, OutputIterator out_it, Predicate pred)
|
||||
{
|
||||
BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept<const SinglePassRange> ));
|
||||
return std::remove_copy_if(boost::begin(rng), boost::end(rng), out_it, pred);
|
||||
}
|
||||
}
|
||||
|
||||
#endif // include guard
|
||||
@@ -0,0 +1,118 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2011 Joel de Guzman
|
||||
Copyright (c) 2006 Dan Marsden
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
==============================================================================*/
|
||||
#ifndef BOOST_PP_IS_ITERATING
|
||||
#if !defined(FUSION_ZIP_HPP_20060125_2058)
|
||||
#define FUSION_ZIP_HPP_20060125_2058
|
||||
|
||||
#include <boost/fusion/view/zip_view.hpp>
|
||||
#include <boost/fusion/adapted/mpl.hpp>
|
||||
#include <boost/fusion/container/vector.hpp>
|
||||
#include <boost/fusion/container/vector/convert.hpp>
|
||||
#include <boost/fusion/support/detail/pp_round.hpp>
|
||||
#include <boost/type_traits/add_reference.hpp>
|
||||
#include <boost/preprocessor/repetition/enum.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_params.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_params_with_a_default.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_binary_params.hpp>
|
||||
#include <boost/preprocessor/repetition/repeat_from_to.hpp>
|
||||
#include <boost/preprocessor/arithmetic/inc.hpp>
|
||||
#include <boost/preprocessor/iteration/iterate.hpp>
|
||||
#include <boost/mpl/vector.hpp>
|
||||
#include <boost/mpl/transform.hpp>
|
||||
#include <boost/mpl/placeholders.hpp>
|
||||
|
||||
#if !defined(FUSION_MAX_ZIP_SEQUENCES)
|
||||
#define FUSION_MAX_ZIP_SEQUENCES 10
|
||||
#endif
|
||||
|
||||
#define FUSION_MAX_ZIP_SEQUENCES_STR BOOST_PP_STRINGIZE(BOOST_FUSION_PP_ROUND_UP(FUSION_MAX_ZIP_SEQUENCES))
|
||||
|
||||
#if !defined(BOOST_FUSION_DONT_USE_PREPROCESSED_FILES)
|
||||
#include <boost/fusion/algorithm/transformation/detail/preprocessed/zip.hpp>
|
||||
#else
|
||||
#if defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES)
|
||||
#pragma wave option(preserve: 2, line: 0, output: "detail/preprocessed/zip" FUSION_MAX_ZIP_SEQUENCES_STR ".hpp")
|
||||
#endif
|
||||
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2011 Joel de Guzman
|
||||
Copyright (c) 2006 Dan Marsden
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
This is an auto-generated file. Do not edit!
|
||||
==============================================================================*/
|
||||
|
||||
#if defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES)
|
||||
#pragma wave option(preserve: 1)
|
||||
#endif
|
||||
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
struct void_;
|
||||
|
||||
namespace result_of
|
||||
{
|
||||
template<BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT(BOOST_PP_INC(FUSION_MAX_ZIP_SEQUENCES), typename T, fusion::void_)>
|
||||
struct zip;
|
||||
}
|
||||
|
||||
#define FUSION_TEXT(z, n, text) , text
|
||||
|
||||
#define BOOST_PP_FILENAME_1 \
|
||||
<boost/fusion/algorithm/transformation/zip.hpp>
|
||||
#define BOOST_PP_ITERATION_LIMITS (2, FUSION_MAX_ZIP_SEQUENCES)
|
||||
#include BOOST_PP_ITERATE()
|
||||
|
||||
#undef FUSION_TEXT
|
||||
|
||||
}}
|
||||
|
||||
#if defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES)
|
||||
#pragma wave option(output: null)
|
||||
#endif
|
||||
|
||||
#endif // BOOST_FUSION_DONT_USE_PREPROCESSED_FILES
|
||||
|
||||
#endif
|
||||
|
||||
#else
|
||||
|
||||
#define ZIP_ITERATION BOOST_PP_ITERATION()
|
||||
|
||||
namespace result_of
|
||||
{
|
||||
template< BOOST_PP_ENUM_PARAMS(ZIP_ITERATION, typename T) >
|
||||
struct zip< BOOST_PP_ENUM_PARAMS(ZIP_ITERATION, T)
|
||||
BOOST_PP_REPEAT_FROM_TO(BOOST_PP_DEC(ZIP_ITERATION), FUSION_MAX_ZIP_SEQUENCES, FUSION_TEXT, void_)
|
||||
>
|
||||
{
|
||||
typedef mpl::vector< BOOST_PP_ENUM_PARAMS(ZIP_ITERATION, T) > sequences;
|
||||
typedef typename mpl::transform<sequences, add_reference<mpl::_> >::type ref_params;
|
||||
typedef zip_view<typename result_of::as_vector<ref_params>::type> type;
|
||||
};
|
||||
}
|
||||
|
||||
#define FUSION_REF_PARAM(z, n, data) const T ## n&
|
||||
|
||||
template<BOOST_PP_ENUM_PARAMS(ZIP_ITERATION, typename T)>
|
||||
BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
inline typename result_of::zip<BOOST_PP_ENUM_PARAMS(ZIP_ITERATION, const T)>::type
|
||||
zip(BOOST_PP_ENUM_BINARY_PARAMS(ZIP_ITERATION, T, const& t))
|
||||
{
|
||||
fusion::vector<BOOST_PP_ENUM(ZIP_ITERATION, FUSION_REF_PARAM, _)> seqs(
|
||||
BOOST_PP_ENUM_PARAMS(ZIP_ITERATION, t));
|
||||
return typename result_of::zip<BOOST_PP_ENUM_PARAMS(ZIP_ITERATION, const T)>::type(
|
||||
seqs);
|
||||
}
|
||||
|
||||
#undef FUSION_REF_PARAM
|
||||
#undef ZIP_ITERATION
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,175 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2005-2013 Joel de Guzman
|
||||
Copyright (c) 2005-2006 Dan Marsden
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
==============================================================================*/
|
||||
#if !defined(BOOST_FUSION_MAP_ITERATOR_02042013_0835)
|
||||
#define BOOST_FUSION_MAP_ITERATOR_02042013_0835
|
||||
|
||||
#include <boost/fusion/support/config.hpp>
|
||||
#include <boost/fusion/iterator/iterator_facade.hpp>
|
||||
#include <boost/mpl/minus.hpp>
|
||||
#include <boost/mpl/equal_to.hpp>
|
||||
#include <boost/mpl/if.hpp>
|
||||
#include <boost/utility/declval.hpp>
|
||||
#include <boost/type_traits/is_const.hpp>
|
||||
#include <boost/type_traits/add_const.hpp>
|
||||
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
struct random_access_traversal_tag;
|
||||
|
||||
template <typename Seq, int Pos>
|
||||
struct map_iterator
|
||||
: iterator_facade<
|
||||
map_iterator<Seq, Pos>
|
||||
, typename Seq::category>
|
||||
{
|
||||
typedef Seq sequence;
|
||||
typedef mpl::int_<Pos> index;
|
||||
|
||||
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
map_iterator(Seq& seq)
|
||||
: seq_(seq)
|
||||
{}
|
||||
|
||||
template<typename Iterator>
|
||||
struct value_of
|
||||
{
|
||||
typedef typename Iterator::sequence sequence;
|
||||
typedef typename Iterator::index index;
|
||||
typedef
|
||||
decltype(boost::declval<sequence>().get_val(index()))
|
||||
type;
|
||||
};
|
||||
|
||||
template<typename Iterator>
|
||||
struct value_of_data
|
||||
{
|
||||
typedef typename Iterator::sequence sequence;
|
||||
typedef typename Iterator::index index;
|
||||
typedef
|
||||
decltype(boost::declval<sequence>().get_val(index()).second)
|
||||
type;
|
||||
};
|
||||
|
||||
template<typename Iterator>
|
||||
struct key_of
|
||||
{
|
||||
typedef typename Iterator::sequence sequence;
|
||||
typedef typename Iterator::index index;
|
||||
typedef decltype(boost::declval<sequence>().get_key(index())) key_identity_type;
|
||||
typedef typename key_identity_type::type type;
|
||||
};
|
||||
|
||||
template<typename Iterator>
|
||||
struct deref
|
||||
{
|
||||
typedef typename Iterator::sequence sequence;
|
||||
typedef typename Iterator::index index;
|
||||
typedef
|
||||
decltype(boost::declval<sequence>().get(index()))
|
||||
type;
|
||||
|
||||
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
static type
|
||||
call(Iterator const& it)
|
||||
{
|
||||
return it.seq_.get(typename Iterator::index());
|
||||
}
|
||||
};
|
||||
|
||||
template<typename Iterator>
|
||||
struct deref_data
|
||||
{
|
||||
typedef typename Iterator::sequence sequence;
|
||||
typedef typename Iterator::index index;
|
||||
|
||||
typedef decltype(boost::declval<sequence>().get(index()).second) second_type_;
|
||||
|
||||
typedef typename
|
||||
mpl::if_<
|
||||
is_const<sequence>
|
||||
, typename add_const<second_type_>::type
|
||||
, second_type_
|
||||
>::type
|
||||
second_type;
|
||||
|
||||
typedef typename add_reference<second_type>::type type;
|
||||
|
||||
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
static type
|
||||
call(Iterator const& it)
|
||||
{
|
||||
return it.seq_.get(typename Iterator::index()).second;
|
||||
}
|
||||
};
|
||||
|
||||
template <typename Iterator, typename N>
|
||||
struct advance
|
||||
{
|
||||
typedef typename Iterator::index index;
|
||||
typedef typename Iterator::sequence sequence;
|
||||
typedef map_iterator<sequence, index::value + N::value> type;
|
||||
|
||||
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
static type
|
||||
call(Iterator const& i)
|
||||
{
|
||||
return type(i.seq_);
|
||||
}
|
||||
};
|
||||
|
||||
template<typename Iterator>
|
||||
struct next
|
||||
: advance<Iterator, mpl::int_<1> >
|
||||
{};
|
||||
|
||||
template<typename Iterator>
|
||||
struct prior
|
||||
: advance<Iterator, mpl::int_<-1> >
|
||||
{};
|
||||
|
||||
template <typename I1, typename I2>
|
||||
struct distance
|
||||
{
|
||||
typedef typename
|
||||
mpl::minus<
|
||||
typename I2::index, typename I1::index
|
||||
>::type
|
||||
type;
|
||||
|
||||
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
static type
|
||||
call(I1 const&, I2 const&)
|
||||
{
|
||||
return type();
|
||||
}
|
||||
};
|
||||
|
||||
template<typename I1, typename I2>
|
||||
struct equal_to
|
||||
: mpl::equal_to<typename I1::index, typename I2::index>
|
||||
{};
|
||||
|
||||
Seq& seq_;
|
||||
|
||||
private:
|
||||
// silence MSVC warning C4512: assignment operator could not be generated
|
||||
map_iterator& operator= (map_iterator const&);
|
||||
};
|
||||
|
||||
}}
|
||||
|
||||
#ifdef BOOST_FUSION_WORKAROUND_FOR_LWG_2408
|
||||
namespace std
|
||||
{
|
||||
template <typename Seq, int Pos>
|
||||
struct iterator_traits< ::boost::fusion::map_iterator<Seq, Pos> >
|
||||
{ };
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,235 @@
|
||||
//---------------------------------------------------------------------------//
|
||||
// Copyright (c) 2013 Kyle Lutz <kyle.r.lutz@gmail.com>
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0
|
||||
// See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt
|
||||
//
|
||||
// See http://boostorg.github.com/compute for more information.
|
||||
//---------------------------------------------------------------------------//
|
||||
|
||||
#ifndef BOOST_COMPUTE_PLATFORM_HPP
|
||||
#define BOOST_COMPUTE_PLATFORM_HPP
|
||||
|
||||
#include <algorithm>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include <boost/algorithm/string/split.hpp>
|
||||
#include <boost/algorithm/string/classification.hpp>
|
||||
|
||||
#include <boost/compute/cl.hpp>
|
||||
#include <boost/compute/device.hpp>
|
||||
#include <boost/compute/detail/get_object_info.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace compute {
|
||||
|
||||
/// \class platform
|
||||
/// \brief A compute platform.
|
||||
///
|
||||
/// The platform class provides an interface to an OpenCL platform.
|
||||
///
|
||||
/// To obtain a list of all platforms on the system use the
|
||||
/// system::platforms() method.
|
||||
///
|
||||
/// \see device, context
|
||||
class platform
|
||||
{
|
||||
public:
|
||||
/// Creates a new platform object for \p id.
|
||||
explicit platform(cl_platform_id id)
|
||||
: m_platform(id)
|
||||
{
|
||||
}
|
||||
|
||||
/// Creates a new platform as a copy of \p other.
|
||||
platform(const platform &other)
|
||||
: m_platform(other.m_platform)
|
||||
{
|
||||
}
|
||||
|
||||
/// Copies the platform id from \p other.
|
||||
platform& operator=(const platform &other)
|
||||
{
|
||||
if(this != &other){
|
||||
m_platform = other.m_platform;
|
||||
}
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
/// Destroys the platform object.
|
||||
~platform()
|
||||
{
|
||||
}
|
||||
|
||||
/// Returns the ID of the platform.
|
||||
cl_platform_id id() const
|
||||
{
|
||||
return m_platform;
|
||||
}
|
||||
|
||||
/// Returns the name of the platform.
|
||||
std::string name() const
|
||||
{
|
||||
return get_info<std::string>(CL_PLATFORM_NAME);
|
||||
}
|
||||
|
||||
/// Returns the name of the vendor for the platform.
|
||||
std::string vendor() const
|
||||
{
|
||||
return get_info<std::string>(CL_PLATFORM_VENDOR);
|
||||
}
|
||||
|
||||
/// Returns the profile string for the platform.
|
||||
std::string profile() const
|
||||
{
|
||||
return get_info<std::string>(CL_PLATFORM_PROFILE);
|
||||
}
|
||||
|
||||
/// Returns the version string for the platform.
|
||||
std::string version() const
|
||||
{
|
||||
return get_info<std::string>(CL_PLATFORM_VERSION);
|
||||
}
|
||||
|
||||
/// Returns a list of extensions supported by the platform.
|
||||
std::vector<std::string> extensions() const
|
||||
{
|
||||
std::string extensions_string =
|
||||
get_info<std::string>(CL_PLATFORM_EXTENSIONS);
|
||||
std::vector<std::string> extensions_vector;
|
||||
boost::split(extensions_vector,
|
||||
extensions_string,
|
||||
boost::is_any_of("\t "),
|
||||
boost::token_compress_on);
|
||||
return extensions_vector;
|
||||
}
|
||||
|
||||
/// Returns \c true if the platform supports the extension with
|
||||
/// \p name.
|
||||
bool supports_extension(const std::string &name) const
|
||||
{
|
||||
const std::vector<std::string> extensions = this->extensions();
|
||||
|
||||
return std::find(
|
||||
extensions.begin(), extensions.end(), name) != extensions.end();
|
||||
}
|
||||
|
||||
/// Returns a list of devices on the platform.
|
||||
std::vector<device> devices(cl_device_type type = CL_DEVICE_TYPE_ALL) const
|
||||
{
|
||||
size_t count = device_count(type);
|
||||
if(count == 0){
|
||||
// no devices for this platform
|
||||
return std::vector<device>();
|
||||
}
|
||||
|
||||
std::vector<cl_device_id> device_ids(count);
|
||||
cl_int ret = clGetDeviceIDs(m_platform,
|
||||
type,
|
||||
static_cast<cl_uint>(count),
|
||||
&device_ids[0],
|
||||
0);
|
||||
if(ret != CL_SUCCESS){
|
||||
BOOST_THROW_EXCEPTION(opencl_error(ret));
|
||||
}
|
||||
|
||||
std::vector<device> devices;
|
||||
for(cl_uint i = 0; i < count; i++){
|
||||
devices.push_back(device(device_ids[i]));
|
||||
}
|
||||
|
||||
return devices;
|
||||
}
|
||||
|
||||
/// Returns the number of devices on the platform.
|
||||
size_t device_count(cl_device_type type = CL_DEVICE_TYPE_ALL) const
|
||||
{
|
||||
cl_uint count = 0;
|
||||
cl_int ret = clGetDeviceIDs(m_platform, type, 0, 0, &count);
|
||||
if(ret != CL_SUCCESS){
|
||||
if(ret == CL_DEVICE_NOT_FOUND){
|
||||
// no devices for this platform
|
||||
return 0;
|
||||
}
|
||||
else {
|
||||
// something else went wrong
|
||||
BOOST_THROW_EXCEPTION(opencl_error(ret));
|
||||
}
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
/// Returns information about the platform.
|
||||
///
|
||||
/// \see_opencl_ref{clGetPlatformInfo}
|
||||
template<class T>
|
||||
T get_info(cl_platform_info info) const
|
||||
{
|
||||
return detail::get_object_info<T>(clGetPlatformInfo, m_platform, info);
|
||||
}
|
||||
|
||||
/// \overload
|
||||
template<int Enum>
|
||||
typename detail::get_object_info_type<platform, Enum>::type
|
||||
get_info() const;
|
||||
|
||||
/// Returns the address of the \p function_name extension
|
||||
/// function. Returns \c 0 if \p function_name is invalid.
|
||||
void* get_extension_function_address(const char *function_name) const
|
||||
{
|
||||
#ifdef CL_VERSION_1_2
|
||||
return clGetExtensionFunctionAddressForPlatform(m_platform,
|
||||
function_name);
|
||||
#else
|
||||
return clGetExtensionFunctionAddress(function_name);
|
||||
#endif
|
||||
}
|
||||
|
||||
/// Requests that the platform unload any compiler resources.
|
||||
void unload_compiler()
|
||||
{
|
||||
#ifdef CL_VERSION_1_2
|
||||
clUnloadPlatformCompiler(m_platform);
|
||||
#else
|
||||
clUnloadCompiler();
|
||||
#endif
|
||||
}
|
||||
|
||||
/// Returns \c true if the platform is the same at \p other.
|
||||
bool operator==(const platform &other) const
|
||||
{
|
||||
return m_platform == other.m_platform;
|
||||
}
|
||||
|
||||
/// Returns \c true if the platform is different from \p other.
|
||||
bool operator!=(const platform &other) const
|
||||
{
|
||||
return m_platform != other.m_platform;
|
||||
}
|
||||
|
||||
private:
|
||||
cl_platform_id m_platform;
|
||||
};
|
||||
|
||||
/// \internal_ define get_info() specializations for platform
|
||||
BOOST_COMPUTE_DETAIL_DEFINE_GET_INFO_SPECIALIZATIONS(platform,
|
||||
((std::string, CL_PLATFORM_PROFILE))
|
||||
((std::string, CL_PLATFORM_VERSION))
|
||||
((std::string, CL_PLATFORM_NAME))
|
||||
((std::string, CL_PLATFORM_VENDOR))
|
||||
((std::string, CL_PLATFORM_EXTENSIONS))
|
||||
)
|
||||
|
||||
inline boost::compute::platform device::platform() const
|
||||
{
|
||||
return boost::compute::platform(get_info<CL_DEVICE_PLATFORM>());
|
||||
}
|
||||
|
||||
} // end compute namespace
|
||||
} // end boost namespace
|
||||
|
||||
#endif // BOOST_COMPUTE_PLATFORM_HPP
|
||||
@@ -0,0 +1,21 @@
|
||||
// Copyright David Abrahams 2003.
|
||||
// Distributed under the Boost Software License, Version 1.0. (See
|
||||
// accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
#ifndef COPY_CTOR_MUTATES_RHS_DWA2003219_HPP
|
||||
# define COPY_CTOR_MUTATES_RHS_DWA2003219_HPP
|
||||
|
||||
#include <boost/python/detail/is_auto_ptr.hpp>
|
||||
#include <boost/mpl/bool.hpp>
|
||||
|
||||
namespace boost { namespace python { namespace detail {
|
||||
|
||||
template <class T>
|
||||
struct copy_ctor_mutates_rhs
|
||||
: is_auto_ptr<T>
|
||||
{
|
||||
};
|
||||
|
||||
}}} // namespace boost::python::detail
|
||||
|
||||
#endif // COPY_CTOR_MUTATES_RHS_DWA2003219_HPP
|
||||
@@ -0,0 +1,30 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2003 Hartmut Kaiser
|
||||
http://spirit.sourceforge.net/
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
=============================================================================*/
|
||||
#if !defined(SPIRIT_CLASSIC_VERSION_HPP)
|
||||
#define SPIRIT_CLASSIC_VERSION_HPP
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// This checks, whether the used Boost library is at least V1.32.0
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
#include <boost/version.hpp>
|
||||
|
||||
#if BOOST_VERSION < 103200
|
||||
#error "Spirit v1.8.x needs at least Boost V1.32.0 to compile successfully."
|
||||
#endif
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// This is the version of the current Spirit distribution
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
#define SPIRIT_VERSION 0x1806
|
||||
#define SPIRIT_PIZZA_VERSION SPIRIT_MEGA_VEGGI // :-)
|
||||
|
||||
#endif // defined(SPIRIT_VERSION_HPP)
|
||||
@@ -0,0 +1,47 @@
|
||||
/*
|
||||
Copyright Rene Rivera 2008-2015
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(See accompanying file LICENSE_1_0.txt or copy at
|
||||
http://www.boost.org/LICENSE_1_0.txt)
|
||||
*/
|
||||
|
||||
#ifndef BOOST_PREDEF_LIBRARY_C_UC_H
|
||||
#define BOOST_PREDEF_LIBRARY_C_UC_H
|
||||
|
||||
#include <boost/predef/library/c/_prefix.h>
|
||||
|
||||
#include <boost/predef/version_number.h>
|
||||
#include <boost/predef/make.h>
|
||||
|
||||
/*`
|
||||
[heading `BOOST_LIB_C_UC`]
|
||||
|
||||
[@http://en.wikipedia.org/wiki/Uclibc uClibc] Standard C library.
|
||||
|
||||
[table
|
||||
[[__predef_symbol__] [__predef_version__]]
|
||||
|
||||
[[`__UCLIBC__`] [__predef_detection__]]
|
||||
|
||||
[[`__UCLIBC_MAJOR__`, `__UCLIBC_MINOR__`, `__UCLIBC_SUBLEVEL__`] [V.R.P]]
|
||||
]
|
||||
*/
|
||||
|
||||
#define BOOST_LIB_C_UC BOOST_VERSION_NUMBER_NOT_AVAILABLE
|
||||
|
||||
#if defined(__UCLIBC__)
|
||||
# undef BOOST_LIB_C_UC
|
||||
# define BOOST_LIB_C_UC BOOST_VERSION_NUMBER(\
|
||||
__UCLIBC_MAJOR__,__UCLIBC_MINOR__,__UCLIBC_SUBLEVEL__)
|
||||
#endif
|
||||
|
||||
#if BOOST_LIB_C_UC
|
||||
# define BOOST_LIB_C_UC_AVAILABLE
|
||||
#endif
|
||||
|
||||
#define BOOST_LIB_C_UC_NAME "uClibc"
|
||||
|
||||
#endif
|
||||
|
||||
#include <boost/predef/detail/test.h>
|
||||
BOOST_PREDEF_DECLARE_TEST(BOOST_LIB_C_UC,BOOST_LIB_C_UC_NAME)
|
||||
@@ -0,0 +1,125 @@
|
||||
/*==============================================================================
|
||||
Copyright (c) 2005-2010 Joel de Guzman
|
||||
Copyright (c) 2010 Thomas Heller
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
==============================================================================*/
|
||||
|
||||
#ifndef BOOST_PHOENIX_DEFINE_OPERATOR_HPP
|
||||
#define BOOST_PHOENIX_DEFINE_OPERATOR_HPP
|
||||
|
||||
#include <boost/phoenix/core/meta_grammar.hpp>
|
||||
#include <boost/preprocessor/seq/for_each.hpp>
|
||||
|
||||
#define BOOST_PHOENIX_UNARY_EXPRESSION(__, ___, name) \
|
||||
template <typename Operand> \
|
||||
struct name \
|
||||
: expr<proto::tag::name, Operand> \
|
||||
{}; \
|
||||
/**/
|
||||
|
||||
#define BOOST_PHOENIX_UNARY_RULE(__, ___, name) \
|
||||
struct name \
|
||||
: expression::name<meta_grammar> \
|
||||
{}; \
|
||||
/**/
|
||||
|
||||
#define BOOST_PHOENIX_UNARY_FUNCTIONAL(__, ___, name) \
|
||||
namespace functional \
|
||||
{ \
|
||||
typedef \
|
||||
proto::functional::make_expr<proto::tag::name> \
|
||||
BOOST_PP_CAT(make_, name); \
|
||||
} \
|
||||
namespace result_of \
|
||||
{ \
|
||||
template <typename Operand> \
|
||||
struct BOOST_PP_CAT(make_, name) \
|
||||
: boost::result_of< \
|
||||
functional:: BOOST_PP_CAT(make_, name)( \
|
||||
Operand \
|
||||
) \
|
||||
> \
|
||||
{}; \
|
||||
} \
|
||||
template <typename Operand> \
|
||||
inline \
|
||||
typename result_of::BOOST_PP_CAT(make_, name)<Operand>::type \
|
||||
BOOST_PP_CAT(make_, name)(Operand const & operand) \
|
||||
{ \
|
||||
return functional::BOOST_PP_CAT(make_, name)()(operand); \
|
||||
} \
|
||||
/**/
|
||||
|
||||
#define BOOST_PHOENIX_BINARY_EXPRESSION(__, ___, name) \
|
||||
template <typename Lhs, typename Rhs> \
|
||||
struct name \
|
||||
: expr<proto::tag::name, Lhs, Rhs> \
|
||||
{}; \
|
||||
/**/
|
||||
|
||||
#define BOOST_PHOENIX_BINARY_RULE(__, ___, name) \
|
||||
struct name \
|
||||
: expression::name<meta_grammar, meta_grammar> \
|
||||
{}; \
|
||||
/**/
|
||||
|
||||
#define BOOST_PHOENIX_BINARY_FUNCTIONAL(__, ___, name) \
|
||||
namespace functional \
|
||||
{ \
|
||||
typedef \
|
||||
proto::functional::make_expr<proto::tag::name> \
|
||||
BOOST_PP_CAT(make_, name); \
|
||||
} \
|
||||
namespace result_of \
|
||||
{ \
|
||||
template <typename Lhs, typename Rhs> \
|
||||
struct BOOST_PP_CAT(make_, name) \
|
||||
: boost::result_of< \
|
||||
functional:: BOOST_PP_CAT(make_, name)( \
|
||||
Lhs, Rhs \
|
||||
) \
|
||||
> \
|
||||
{}; \
|
||||
} \
|
||||
template <typename Rhs, typename Lhs> \
|
||||
inline \
|
||||
typename result_of::BOOST_PP_CAT(make_, name)<Rhs, Lhs>::type \
|
||||
BOOST_PP_CAT(make_, name)(Lhs const & lhs, Rhs const & rhs) \
|
||||
{ \
|
||||
return functional::BOOST_PP_CAT(make_, name)()(lhs, rhs); \
|
||||
} \
|
||||
/**/
|
||||
|
||||
#define BOOST_PHOENIX_GRAMMAR(_, __, name) \
|
||||
template <typename Dummy> \
|
||||
struct meta_grammar::case_<proto::tag::name, Dummy> \
|
||||
: enable_rule<rule::name, Dummy> \
|
||||
{}; \
|
||||
/**/
|
||||
|
||||
#define BOOST_PHOENIX_UNARY_OPERATORS(ops) \
|
||||
namespace expression { \
|
||||
BOOST_PP_SEQ_FOR_EACH(BOOST_PHOENIX_UNARY_EXPRESSION, _, ops) \
|
||||
} \
|
||||
namespace rule { \
|
||||
BOOST_PP_SEQ_FOR_EACH(BOOST_PHOENIX_UNARY_RULE, _, ops) \
|
||||
} \
|
||||
BOOST_PP_SEQ_FOR_EACH(BOOST_PHOENIX_GRAMMAR, _, ops) \
|
||||
BOOST_PP_SEQ_FOR_EACH(BOOST_PHOENIX_UNARY_FUNCTIONAL, _, ops) \
|
||||
/**/
|
||||
|
||||
|
||||
#define BOOST_PHOENIX_BINARY_OPERATORS(ops) \
|
||||
namespace expression { \
|
||||
BOOST_PP_SEQ_FOR_EACH(BOOST_PHOENIX_BINARY_EXPRESSION, _, ops) \
|
||||
} \
|
||||
namespace rule { \
|
||||
BOOST_PP_SEQ_FOR_EACH(BOOST_PHOENIX_BINARY_RULE, _, ops) \
|
||||
} \
|
||||
BOOST_PP_SEQ_FOR_EACH(BOOST_PHOENIX_GRAMMAR, _, ops) \
|
||||
BOOST_PP_SEQ_FOR_EACH(BOOST_PHOENIX_BINARY_FUNCTIONAL, _, ops) \
|
||||
/**/
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,18 @@
|
||||
#ifndef BOOST_ATOMIC_HPP
|
||||
#define BOOST_ATOMIC_HPP
|
||||
|
||||
// Copyright (c) 2011 Helge Bahmann
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// This header includes all Boost.Atomic public headers
|
||||
|
||||
#include <boost/atomic/atomic.hpp>
|
||||
|
||||
#ifdef BOOST_HAS_PRAGMA_ONCE
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,31 @@
|
||||
// Boost.Units - A C++ library for zero-overhead dimensional analysis and
|
||||
// unit/quantity manipulation and conversion
|
||||
//
|
||||
// Copyright (C) 2003-2008 Matthias Christian Schabel
|
||||
// Copyright (C) 2008 Steven Watanabe
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See
|
||||
// accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#ifndef BOOST_UNITS_SI_MOMENTUM_HPP
|
||||
#define BOOST_UNITS_SI_MOMENTUM_HPP
|
||||
|
||||
#include <boost/units/systems/si/base.hpp>
|
||||
#include <boost/units/physical_dimensions/momentum.hpp>
|
||||
|
||||
namespace boost {
|
||||
|
||||
namespace units {
|
||||
|
||||
namespace si {
|
||||
|
||||
typedef unit<momentum_dimension,si::system> momentum;
|
||||
|
||||
} // namespace si
|
||||
|
||||
} // namespace units
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#endif // BOOST_UNITS_SI_MOMENTUM_HPP
|
||||
@@ -0,0 +1,300 @@
|
||||
/*==============================================================================
|
||||
Copyright (c) 2001-2010 Joel de Guzman
|
||||
Copyright (c) 2010 Thomas Heller
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
==============================================================================*/
|
||||
#ifndef BOOST_PHOENIX_STATEMENT_SWITCH_HPP
|
||||
#define BOOST_PHOENIX_STATEMENT_SWITCH_HPP
|
||||
|
||||
#include <boost/phoenix/core/limits.hpp>
|
||||
#include <boost/fusion/iterator/advance.hpp>
|
||||
#include <boost/phoenix/core/call.hpp>
|
||||
#include <boost/phoenix/core/expression.hpp>
|
||||
#include <boost/phoenix/core/meta_grammar.hpp>
|
||||
#include <boost/phoenix/core/is_nullary.hpp>
|
||||
#include <boost/phoenix/support/iterate.hpp>
|
||||
#include <boost/proto/make_expr.hpp>
|
||||
#include <boost/proto/fusion.hpp>
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable: 4065) // switch statement contains 'default' but no 'case' labels
|
||||
#endif
|
||||
|
||||
BOOST_PHOENIX_DEFINE_EXPRESSION(
|
||||
(boost)(phoenix)(switch_case)
|
||||
, (proto::terminal<proto::_>)
|
||||
(meta_grammar)
|
||||
)
|
||||
|
||||
BOOST_PHOENIX_DEFINE_EXPRESSION(
|
||||
(boost)(phoenix)(switch_default_case)
|
||||
, (meta_grammar)
|
||||
)
|
||||
|
||||
namespace boost { namespace phoenix
|
||||
{
|
||||
namespace detail
|
||||
{
|
||||
struct switch_case_grammar;
|
||||
struct switch_case_with_default_grammar;
|
||||
struct switch_grammar
|
||||
: proto::or_<
|
||||
proto::when<
|
||||
detail::switch_case_grammar
|
||||
, mpl::false_()
|
||||
>
|
||||
, proto::when<
|
||||
detail::switch_case_with_default_grammar
|
||||
, mpl::true_()
|
||||
>
|
||||
>
|
||||
{};
|
||||
}
|
||||
|
||||
namespace detail
|
||||
{
|
||||
struct switch_case_is_nullary
|
||||
: proto::or_<
|
||||
proto::when<
|
||||
proto::comma<
|
||||
switch_case_is_nullary
|
||||
, proto::or_<phoenix::rule::switch_default_case, phoenix::rule::switch_case>
|
||||
>
|
||||
, mpl::and_<
|
||||
switch_case_is_nullary(
|
||||
proto::_child_c<0>
|
||||
, proto::_state
|
||||
)
|
||||
, switch_case_is_nullary(
|
||||
proto::_child_c<1>
|
||||
, proto::_state
|
||||
)
|
||||
>()
|
||||
>
|
||||
, proto::when<
|
||||
proto::or_<phoenix::rule::switch_default_case, phoenix::rule::switch_case>
|
||||
, evaluator(proto::_child_c<0>, proto::_state)
|
||||
>
|
||||
>
|
||||
{};
|
||||
|
||||
struct switch_case_grammar
|
||||
: proto::or_<
|
||||
proto::comma<switch_case_grammar, phoenix::rule::switch_case>
|
||||
, proto::when<phoenix::rule::switch_case, proto::_>
|
||||
>
|
||||
{};
|
||||
|
||||
struct switch_case_with_default_grammar
|
||||
: proto::or_<
|
||||
proto::comma<switch_case_grammar, phoenix::rule::switch_default_case>
|
||||
, proto::when<phoenix::rule::switch_default_case, proto::_>
|
||||
>
|
||||
{};
|
||||
|
||||
struct switch_size
|
||||
: proto::or_<
|
||||
proto::when<
|
||||
proto::comma<switch_size, proto::_>
|
||||
, mpl::next<switch_size(proto::_left)>()
|
||||
>
|
||||
, proto::when<proto::_, mpl::int_<1>()>
|
||||
>
|
||||
{};
|
||||
}
|
||||
}}
|
||||
|
||||
BOOST_PHOENIX_DEFINE_EXPRESSION(
|
||||
(boost)(phoenix)(switch_)
|
||||
, (meta_grammar) // Cond
|
||||
(detail::switch_grammar) // Cases
|
||||
)
|
||||
|
||||
namespace boost { namespace phoenix {
|
||||
|
||||
template <typename Dummy>
|
||||
struct is_nullary::when<rule::switch_, Dummy>
|
||||
: proto::and_<
|
||||
evaluator(proto::_child_c<0>, _context)
|
||||
, detail::switch_case_is_nullary(proto::_child_c<1>, _context)
|
||||
>
|
||||
{};
|
||||
|
||||
struct switch_eval
|
||||
{
|
||||
typedef void result_type;
|
||||
|
||||
template <typename Context>
|
||||
result_type
|
||||
operator()(Context const &) const
|
||||
{
|
||||
}
|
||||
|
||||
template <typename Cond, typename Cases, typename Context>
|
||||
result_type
|
||||
operator()(Cond const & cond, Cases const & cases, Context const & ctx) const
|
||||
{
|
||||
this->evaluate(
|
||||
ctx
|
||||
, cond
|
||||
, cases
|
||||
, typename detail::switch_size::impl<Cases, int, proto::empty_env>::result_type()
|
||||
, typename detail::switch_grammar::impl<Cases, int, proto::empty_env>::result_type()
|
||||
);
|
||||
}
|
||||
|
||||
private:
|
||||
template <typename Context, typename Cond, typename Cases>
|
||||
result_type
|
||||
evaluate(
|
||||
Context const & ctx
|
||||
, Cond const & cond
|
||||
, Cases const & cases
|
||||
, mpl::int_<1>
|
||||
, mpl::false_
|
||||
) const
|
||||
{
|
||||
typedef
|
||||
typename proto::result_of::value<
|
||||
typename proto::result_of::child_c<
|
||||
Cases
|
||||
, 0
|
||||
>::type
|
||||
>::type
|
||||
case_label;
|
||||
|
||||
switch(boost::phoenix::eval(cond, ctx))
|
||||
{
|
||||
case case_label::value:
|
||||
boost::phoenix::eval(proto::child_c<1>(cases), ctx);
|
||||
}
|
||||
}
|
||||
|
||||
template <typename Context, typename Cond, typename Cases>
|
||||
result_type
|
||||
evaluate(
|
||||
Context const & ctx
|
||||
, Cond const & cond
|
||||
, Cases const & cases
|
||||
, mpl::int_<1>
|
||||
, mpl::true_
|
||||
) const
|
||||
{
|
||||
switch(boost::phoenix::eval(cond, ctx))
|
||||
{
|
||||
default:
|
||||
boost::phoenix::eval(proto::child_c<0>(cases), ctx);
|
||||
}
|
||||
}
|
||||
|
||||
// Bring in the evaluation functions
|
||||
#include <boost/phoenix/statement/detail/switch.hpp>
|
||||
};
|
||||
|
||||
template <typename Dummy>
|
||||
struct default_actions::when<rule::switch_, Dummy>
|
||||
: call<switch_eval>
|
||||
{};
|
||||
|
||||
template <int N, typename A>
|
||||
inline
|
||||
typename proto::result_of::make_expr<
|
||||
tag::switch_case
|
||||
, proto::basic_default_domain
|
||||
, mpl::int_<N>
|
||||
, A
|
||||
>::type const
|
||||
case_(A const & a)
|
||||
{
|
||||
return
|
||||
proto::make_expr<
|
||||
tag::switch_case
|
||||
, proto::basic_default_domain
|
||||
>(
|
||||
mpl::int_<N>()
|
||||
, a
|
||||
);
|
||||
}
|
||||
|
||||
template <typename A>
|
||||
inline
|
||||
typename proto::result_of::make_expr<
|
||||
tag::switch_default_case
|
||||
, proto::basic_default_domain
|
||||
, A
|
||||
>::type const
|
||||
default_(A const& a)
|
||||
{
|
||||
return
|
||||
proto::make_expr<
|
||||
tag::switch_default_case
|
||||
, proto::basic_default_domain
|
||||
>(a);
|
||||
}
|
||||
|
||||
template <typename Cond>
|
||||
struct switch_gen
|
||||
{
|
||||
switch_gen(Cond const& cond_) : cond(cond_) {}
|
||||
|
||||
template <typename Cases>
|
||||
typename expression::switch_<
|
||||
Cond
|
||||
, Cases
|
||||
>::type
|
||||
operator[](Cases const& cases) const
|
||||
{
|
||||
return
|
||||
this->generate(
|
||||
cases
|
||||
, proto::matches<Cases, detail::switch_grammar>()
|
||||
);
|
||||
}
|
||||
|
||||
private:
|
||||
Cond const& cond;
|
||||
|
||||
template <typename Cases>
|
||||
typename expression::switch_<
|
||||
Cond
|
||||
, Cases
|
||||
>::type
|
||||
generate(Cases const & cases, mpl::true_) const
|
||||
{
|
||||
return expression::switch_<Cond, Cases>::make(cond, cases);
|
||||
}
|
||||
|
||||
template <typename Cases>
|
||||
typename expression::switch_<
|
||||
Cond
|
||||
, Cases
|
||||
>::type
|
||||
generate(Cases const &, mpl::false_) const
|
||||
{
|
||||
BOOST_MPL_ASSERT_MSG(
|
||||
false
|
||||
, INVALID_SWITCH_CASE_STATEMENT
|
||||
, (Cases)
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename Cond>
|
||||
inline
|
||||
switch_gen<Cond> const
|
||||
switch_(Cond const& cond)
|
||||
{
|
||||
return switch_gen<Cond>(cond);
|
||||
}
|
||||
|
||||
}}
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,550 @@
|
||||
///////////////////////////////////////////////////////////////
|
||||
// Copyright 2012 John Maddock. Distributed under the Boost
|
||||
// Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_
|
||||
//
|
||||
// Comparison operators for cpp_int_backend:
|
||||
//
|
||||
#ifndef BOOST_MP_CPP_INT_ADD_HPP
|
||||
#define BOOST_MP_CPP_INT_ADD_HPP
|
||||
|
||||
namespace boost{ namespace multiprecision{ namespace backends{
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable:4127) // conditional expression is constant
|
||||
#endif
|
||||
|
||||
//
|
||||
// This is the key addition routine where all the argument types are non-trivial cpp_int's:
|
||||
//
|
||||
template <class CppInt1, class CppInt2, class CppInt3>
|
||||
inline void add_unsigned(CppInt1& result, const CppInt2& a, const CppInt3& b) BOOST_MP_NOEXCEPT_IF(is_non_throwing_cpp_int<CppInt1>::value)
|
||||
{
|
||||
using std::swap;
|
||||
|
||||
// Nothing fancy, just let uintmax_t take the strain:
|
||||
double_limb_type carry = 0;
|
||||
unsigned m, x;
|
||||
unsigned as = a.size();
|
||||
unsigned bs = b.size();
|
||||
minmax(as, bs, m, x);
|
||||
if(x == 1)
|
||||
{
|
||||
bool s = a.sign();
|
||||
result = static_cast<double_limb_type>(*a.limbs()) + static_cast<double_limb_type>(*b.limbs());
|
||||
result.sign(s);
|
||||
return;
|
||||
}
|
||||
result.resize(x, x);
|
||||
typename CppInt2::const_limb_pointer pa = a.limbs();
|
||||
typename CppInt3::const_limb_pointer pb = b.limbs();
|
||||
typename CppInt1::limb_pointer pr = result.limbs();
|
||||
typename CppInt1::limb_pointer pr_end = pr + m;
|
||||
|
||||
if(as < bs)
|
||||
swap(pa, pb);
|
||||
|
||||
// First where a and b overlap:
|
||||
while(pr != pr_end)
|
||||
{
|
||||
carry += static_cast<double_limb_type>(*pa) + static_cast<double_limb_type>(*pb);
|
||||
#ifdef __MSVC_RUNTIME_CHECKS
|
||||
*pr = static_cast<limb_type>(carry & ~static_cast<limb_type>(0));
|
||||
#else
|
||||
*pr = static_cast<limb_type>(carry);
|
||||
#endif
|
||||
carry >>= CppInt1::limb_bits;
|
||||
++pr, ++pa, ++pb;
|
||||
}
|
||||
pr_end += x - m;
|
||||
// Now where only a has digits:
|
||||
while(pr != pr_end)
|
||||
{
|
||||
if(!carry)
|
||||
{
|
||||
if(pa != pr)
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, >= 1600)
|
||||
std::copy(pa, pa + (pr_end - pr), stdext::checked_array_iterator<limb_type*>(pr, result.size()));
|
||||
#else
|
||||
std::copy(pa, pa + (pr_end - pr), pr);
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
carry += static_cast<double_limb_type>(*pa);
|
||||
#ifdef __MSVC_RUNTIME_CHECKS
|
||||
*pr = static_cast<limb_type>(carry & ~static_cast<limb_type>(0));
|
||||
#else
|
||||
*pr = static_cast<limb_type>(carry);
|
||||
#endif
|
||||
carry >>= CppInt1::limb_bits;
|
||||
++pr, ++pa;
|
||||
}
|
||||
if(carry)
|
||||
{
|
||||
// We overflowed, need to add one more limb:
|
||||
result.resize(x + 1, x + 1);
|
||||
if(CppInt1::variable || (result.size() > x))
|
||||
result.limbs()[x] = static_cast<limb_type>(carry);
|
||||
}
|
||||
result.normalize();
|
||||
result.sign(a.sign());
|
||||
}
|
||||
//
|
||||
// As above, but for adding a single limb to a non-trivial cpp_int:
|
||||
//
|
||||
template <class CppInt1, class CppInt2>
|
||||
inline void add_unsigned(CppInt1& result, const CppInt2& a, const limb_type& o) BOOST_MP_NOEXCEPT_IF(is_non_throwing_cpp_int<CppInt1>::value)
|
||||
{
|
||||
// Addition using modular arithmetic.
|
||||
// Nothing fancy, just let uintmax_t take the strain:
|
||||
if(&result != &a)
|
||||
result.resize(a.size(), a.size());
|
||||
double_limb_type carry = o;
|
||||
typename CppInt1::limb_pointer pr = result.limbs();
|
||||
typename CppInt2::const_limb_pointer pa = a.limbs();
|
||||
unsigned i = 0;
|
||||
// Addition with carry until we either run out of digits or carry is zero:
|
||||
for(; carry && (i < result.size()); ++i)
|
||||
{
|
||||
carry += static_cast<double_limb_type>(pa[i]);
|
||||
#ifdef __MSVC_RUNTIME_CHECKS
|
||||
pr[i] = static_cast<limb_type>(carry & ~static_cast<limb_type>(0));
|
||||
#else
|
||||
pr[i] = static_cast<limb_type>(carry);
|
||||
#endif
|
||||
carry >>= CppInt1::limb_bits;
|
||||
}
|
||||
// Just copy any remaining digits:
|
||||
if(&a != &result)
|
||||
{
|
||||
for(; i < result.size(); ++i)
|
||||
pr[i] = pa[i];
|
||||
}
|
||||
if(carry)
|
||||
{
|
||||
// We overflowed, need to add one more limb:
|
||||
unsigned x = result.size();
|
||||
result.resize(x + 1, x + 1);
|
||||
if(CppInt1::variable || (result.size() > x))
|
||||
result.limbs()[x] = static_cast<limb_type>(carry);
|
||||
}
|
||||
result.normalize();
|
||||
result.sign(a.sign());
|
||||
}
|
||||
//
|
||||
// Core subtraction routine for all non-trivial cpp_int's:
|
||||
//
|
||||
template <class CppInt1, class CppInt2, class CppInt3>
|
||||
inline void subtract_unsigned(CppInt1& result, const CppInt2& a, const CppInt3& b) BOOST_MP_NOEXCEPT_IF(is_non_throwing_cpp_int<CppInt1>::value)
|
||||
{
|
||||
using std::swap;
|
||||
|
||||
// Nothing fancy, just let uintmax_t take the strain:
|
||||
double_limb_type borrow = 0;
|
||||
unsigned m, x;
|
||||
minmax(a.size(), b.size(), m, x);
|
||||
//
|
||||
// special cases for small limb counts:
|
||||
//
|
||||
if(x == 1)
|
||||
{
|
||||
bool s = a.sign();
|
||||
limb_type al = *a.limbs();
|
||||
limb_type bl = *b.limbs();
|
||||
if(bl > al)
|
||||
{
|
||||
std::swap(al, bl);
|
||||
s = !s;
|
||||
}
|
||||
result = al - bl;
|
||||
result.sign(s);
|
||||
return;
|
||||
}
|
||||
// This isn't used till later, but comparison has to occur before we resize the result,
|
||||
// as that may also resize a or b if this is an inplace operation:
|
||||
int c = a.compare_unsigned(b);
|
||||
// Set up the result vector:
|
||||
result.resize(x, x);
|
||||
// Now that a, b, and result are stable, get pointers to their limbs:
|
||||
typename CppInt2::const_limb_pointer pa = a.limbs();
|
||||
typename CppInt3::const_limb_pointer pb = b.limbs();
|
||||
typename CppInt1::limb_pointer pr = result.limbs();
|
||||
bool swapped = false;
|
||||
if(c < 0)
|
||||
{
|
||||
swap(pa, pb);
|
||||
swapped = true;
|
||||
}
|
||||
else if(c == 0)
|
||||
{
|
||||
result = static_cast<limb_type>(0);
|
||||
return;
|
||||
}
|
||||
|
||||
unsigned i = 0;
|
||||
// First where a and b overlap:
|
||||
while(i < m)
|
||||
{
|
||||
borrow = static_cast<double_limb_type>(pa[i]) - static_cast<double_limb_type>(pb[i]) - borrow;
|
||||
pr[i] = static_cast<limb_type>(borrow);
|
||||
borrow = (borrow >> CppInt1::limb_bits) & 1u;
|
||||
++i;
|
||||
}
|
||||
// Now where only a has digits, only as long as we've borrowed:
|
||||
while(borrow && (i < x))
|
||||
{
|
||||
borrow = static_cast<double_limb_type>(pa[i]) - borrow;
|
||||
pr[i] = static_cast<limb_type>(borrow);
|
||||
borrow = (borrow >> CppInt1::limb_bits) & 1u;
|
||||
++i;
|
||||
}
|
||||
// Any remaining digits are the same as those in pa:
|
||||
if((x != i) && (pa != pr))
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, >= 1600)
|
||||
std::copy(pa + i, pa + x, stdext::checked_array_iterator<limb_type*>(pr + i, result.size() - i));
|
||||
#else
|
||||
std::copy(pa + i, pa + x, pr + i);
|
||||
#endif
|
||||
BOOST_ASSERT(0 == borrow);
|
||||
|
||||
//
|
||||
// We may have lost digits, if so update limb usage count:
|
||||
//
|
||||
result.normalize();
|
||||
result.sign(a.sign());
|
||||
if(swapped)
|
||||
result.negate();
|
||||
}
|
||||
//
|
||||
// And again to subtract a single limb:
|
||||
//
|
||||
template <class CppInt1, class CppInt2>
|
||||
inline void subtract_unsigned(CppInt1& result, const CppInt2& a, const limb_type& b) BOOST_MP_NOEXCEPT_IF(is_non_throwing_cpp_int<CppInt1>::value)
|
||||
{
|
||||
// Subtract one limb.
|
||||
// Nothing fancy, just let uintmax_t take the strain:
|
||||
BOOST_STATIC_CONSTANT(double_limb_type, borrow = static_cast<double_limb_type>(CppInt1::max_limb_value) + 1);
|
||||
result.resize(a.size(), a.size());
|
||||
typename CppInt1::limb_pointer pr = result.limbs();
|
||||
typename CppInt2::const_limb_pointer pa = a.limbs();
|
||||
if(*pa >= b)
|
||||
{
|
||||
*pr = *pa - b;
|
||||
if(&result != &a)
|
||||
{
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, >= 1600)
|
||||
std::copy(pa + 1, pa + a.size(), stdext::checked_array_iterator<limb_type*>(pr + 1, result.size() - 1));
|
||||
#else
|
||||
std::copy(pa + 1, pa + a.size(), pr + 1);
|
||||
#endif
|
||||
result.sign(a.sign());
|
||||
}
|
||||
else if((result.size() == 1) && (*pr == 0))
|
||||
{
|
||||
result.sign(false); // zero is unsigned.
|
||||
}
|
||||
}
|
||||
else if(result.size() == 1)
|
||||
{
|
||||
*pr = b - *pa;
|
||||
result.sign(!a.sign());
|
||||
}
|
||||
else
|
||||
{
|
||||
*pr = static_cast<limb_type>((borrow + *pa) - b);
|
||||
unsigned i = 1;
|
||||
while(!pa[i])
|
||||
{
|
||||
pr[i] = CppInt1::max_limb_value;
|
||||
++i;
|
||||
}
|
||||
pr[i] = pa[i] - 1;
|
||||
if(&result != &a)
|
||||
{
|
||||
++i;
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, >= 1600)
|
||||
std::copy(pa + i, pa + a.size(), stdext::checked_array_iterator<limb_type*>(pr + i, result.size() - i));
|
||||
#else
|
||||
std::copy(pa + i, pa + a.size(), pr + i);
|
||||
#endif
|
||||
}
|
||||
result.normalize();
|
||||
result.sign(a.sign());
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Now the actual functions called by the front end, all of which forward to one of the above:
|
||||
//
|
||||
template <unsigned MinBits1, unsigned MaxBits1, cpp_integer_type SignType1, cpp_int_check_type Checked1, class Allocator1, unsigned MinBits2, unsigned MaxBits2, cpp_integer_type SignType2, cpp_int_check_type Checked2, class Allocator2>
|
||||
BOOST_MP_FORCEINLINE typename enable_if_c<!is_trivial_cpp_int<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value && !is_trivial_cpp_int<cpp_int_backend<MinBits2, MaxBits2, SignType2, Checked2, Allocator2> >::value >::type
|
||||
eval_add(
|
||||
cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1>& result,
|
||||
const cpp_int_backend<MinBits2, MaxBits2, SignType2, Checked2, Allocator2>& o) BOOST_MP_NOEXCEPT_IF((is_non_throwing_cpp_int<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value))
|
||||
{
|
||||
eval_add(result, result, o);
|
||||
}
|
||||
template <unsigned MinBits1, unsigned MaxBits1, cpp_integer_type SignType1, cpp_int_check_type Checked1, class Allocator1, unsigned MinBits2, unsigned MaxBits2, cpp_integer_type SignType2, cpp_int_check_type Checked2, class Allocator2, unsigned MinBits3, unsigned MaxBits3, cpp_integer_type SignType3, cpp_int_check_type Checked3, class Allocator3>
|
||||
inline typename enable_if_c<!is_trivial_cpp_int<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value && !is_trivial_cpp_int<cpp_int_backend<MinBits2, MaxBits2, SignType2, Checked2, Allocator2> >::value && !is_trivial_cpp_int<cpp_int_backend<MinBits3, MaxBits3, SignType3, Checked3, Allocator3> >::value >::type
|
||||
eval_add(
|
||||
cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1>& result,
|
||||
const cpp_int_backend<MinBits2, MaxBits2, SignType2, Checked2, Allocator2>& a,
|
||||
const cpp_int_backend<MinBits3, MaxBits3, SignType3, Checked3, Allocator3>& b) BOOST_MP_NOEXCEPT_IF((is_non_throwing_cpp_int<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value))
|
||||
{
|
||||
if(a.sign() != b.sign())
|
||||
{
|
||||
subtract_unsigned(result, a, b);
|
||||
return;
|
||||
}
|
||||
add_unsigned(result, a, b);
|
||||
}
|
||||
template <unsigned MinBits1, unsigned MaxBits1, cpp_integer_type SignType1, cpp_int_check_type Checked1, class Allocator1>
|
||||
BOOST_MP_FORCEINLINE typename enable_if_c<!is_trivial_cpp_int<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value>::type
|
||||
eval_add(cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1>& result, const limb_type& o) BOOST_MP_NOEXCEPT_IF((is_non_throwing_cpp_int<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value))
|
||||
{
|
||||
if(result.sign())
|
||||
{
|
||||
subtract_unsigned(result, result, o);
|
||||
}
|
||||
else
|
||||
add_unsigned(result, result, o);
|
||||
}
|
||||
template <unsigned MinBits1, unsigned MaxBits1, cpp_integer_type SignType1, cpp_int_check_type Checked1, class Allocator1, unsigned MinBits2, unsigned MaxBits2, cpp_integer_type SignType2, cpp_int_check_type Checked2, class Allocator2>
|
||||
BOOST_MP_FORCEINLINE typename enable_if_c<!is_trivial_cpp_int<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value && !is_trivial_cpp_int<cpp_int_backend<MinBits2, MaxBits2, SignType2, Checked2, Allocator2> >::value >::type
|
||||
eval_add(
|
||||
cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1>& result,
|
||||
const cpp_int_backend<MinBits2, MaxBits2, SignType2, Checked2, Allocator2>& a,
|
||||
const limb_type& o) BOOST_MP_NOEXCEPT_IF((is_non_throwing_cpp_int<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value))
|
||||
{
|
||||
if(a.sign())
|
||||
{
|
||||
subtract_unsigned(result, a, o);
|
||||
}
|
||||
else
|
||||
add_unsigned(result, a, o);
|
||||
}
|
||||
template <unsigned MinBits1, unsigned MaxBits1, cpp_integer_type SignType1, cpp_int_check_type Checked1, class Allocator1>
|
||||
BOOST_MP_FORCEINLINE typename enable_if_c<!is_trivial_cpp_int<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value>::type
|
||||
eval_add(
|
||||
cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1>& result,
|
||||
const signed_limb_type& o) BOOST_MP_NOEXCEPT_IF((is_non_throwing_cpp_int<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value))
|
||||
{
|
||||
if(o < 0)
|
||||
eval_subtract(result, static_cast<limb_type>(boost::multiprecision::detail::unsigned_abs(o)));
|
||||
else if(o > 0)
|
||||
eval_add(result, static_cast<limb_type>(o));
|
||||
}
|
||||
template <unsigned MinBits1, unsigned MaxBits1, cpp_integer_type SignType1, cpp_int_check_type Checked1, class Allocator1, unsigned MinBits2, unsigned MaxBits2, cpp_integer_type SignType2, cpp_int_check_type Checked2, class Allocator2>
|
||||
BOOST_MP_FORCEINLINE typename enable_if_c<!is_trivial_cpp_int<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value && !is_trivial_cpp_int<cpp_int_backend<MinBits2, MaxBits2, SignType2, Checked2, Allocator2> >::value >::type
|
||||
eval_add(
|
||||
cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1>& result,
|
||||
const cpp_int_backend<MinBits2, MaxBits2, SignType2, Checked2, Allocator2>& a,
|
||||
const signed_limb_type& o) BOOST_MP_NOEXCEPT_IF((is_non_throwing_cpp_int<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value))
|
||||
{
|
||||
if(o < 0)
|
||||
eval_subtract(result, a, static_cast<limb_type>(boost::multiprecision::detail::unsigned_abs(o)));
|
||||
else if(o > 0)
|
||||
eval_add(result, a, static_cast<limb_type>(o));
|
||||
else if(&result != &a)
|
||||
result = a;
|
||||
}
|
||||
template <unsigned MinBits1, unsigned MaxBits1, cpp_integer_type SignType1, cpp_int_check_type Checked1, class Allocator1>
|
||||
BOOST_MP_FORCEINLINE typename enable_if_c<!is_trivial_cpp_int<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value>::type
|
||||
eval_subtract(
|
||||
cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1>& result,
|
||||
const limb_type& o) BOOST_MP_NOEXCEPT_IF((is_non_throwing_cpp_int<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value))
|
||||
{
|
||||
if(result.sign())
|
||||
{
|
||||
add_unsigned(result, result, o);
|
||||
}
|
||||
else
|
||||
subtract_unsigned(result, result, o);
|
||||
}
|
||||
template <unsigned MinBits1, unsigned MaxBits1, cpp_integer_type SignType1, cpp_int_check_type Checked1, class Allocator1, unsigned MinBits2, unsigned MaxBits2, cpp_integer_type SignType2, cpp_int_check_type Checked2, class Allocator2>
|
||||
BOOST_MP_FORCEINLINE typename enable_if_c<!is_trivial_cpp_int<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value && !is_trivial_cpp_int<cpp_int_backend<MinBits2, MaxBits2, SignType2, Checked2, Allocator2> >::value >::type
|
||||
eval_subtract(
|
||||
cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1>& result,
|
||||
const cpp_int_backend<MinBits2, MaxBits2, SignType2, Checked2, Allocator2>& a,
|
||||
const limb_type& o) BOOST_MP_NOEXCEPT_IF((is_non_throwing_cpp_int<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value))
|
||||
{
|
||||
if(a.sign())
|
||||
{
|
||||
add_unsigned(result, a, o);
|
||||
}
|
||||
else
|
||||
{
|
||||
subtract_unsigned(result, a, o);
|
||||
}
|
||||
}
|
||||
template <unsigned MinBits1, unsigned MaxBits1, cpp_integer_type SignType1, cpp_int_check_type Checked1, class Allocator1>
|
||||
BOOST_MP_FORCEINLINE typename enable_if_c<!is_trivial_cpp_int<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value>::type
|
||||
eval_subtract(
|
||||
cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1>& result,
|
||||
const signed_limb_type& o) BOOST_MP_NOEXCEPT_IF((is_non_throwing_cpp_int<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value))
|
||||
{
|
||||
if(o)
|
||||
{
|
||||
if(o < 0)
|
||||
eval_add(result, static_cast<limb_type>(boost::multiprecision::detail::unsigned_abs(o)));
|
||||
else
|
||||
eval_subtract(result, static_cast<limb_type>(o));
|
||||
}
|
||||
}
|
||||
template <unsigned MinBits1, unsigned MaxBits1, cpp_integer_type SignType1, cpp_int_check_type Checked1, class Allocator1, unsigned MinBits2, unsigned MaxBits2, cpp_integer_type SignType2, cpp_int_check_type Checked2, class Allocator2>
|
||||
BOOST_MP_FORCEINLINE typename enable_if_c<!is_trivial_cpp_int<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value && !is_trivial_cpp_int<cpp_int_backend<MinBits2, MaxBits2, SignType2, Checked2, Allocator2> >::value >::type
|
||||
eval_subtract(
|
||||
cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1>& result,
|
||||
const cpp_int_backend<MinBits2, MaxBits2, SignType2, Checked2, Allocator2>& a,
|
||||
const signed_limb_type& o) BOOST_MP_NOEXCEPT_IF((is_non_throwing_cpp_int<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value))
|
||||
{
|
||||
if(o)
|
||||
{
|
||||
if(o < 0)
|
||||
eval_add(result, a, static_cast<limb_type>(boost::multiprecision::detail::unsigned_abs(o)));
|
||||
else
|
||||
eval_subtract(result, a, static_cast<limb_type>(o));
|
||||
}
|
||||
else if(&result != &a)
|
||||
result = a;
|
||||
}
|
||||
|
||||
template <unsigned MinBits1, unsigned MaxBits1, cpp_integer_type SignType1, cpp_int_check_type Checked1, class Allocator1>
|
||||
BOOST_MP_FORCEINLINE typename enable_if_c<!is_trivial_cpp_int<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value>::type
|
||||
eval_increment(cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1>& result) BOOST_MP_NOEXCEPT_IF((is_non_throwing_cpp_int<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value))
|
||||
{
|
||||
static const limb_type one = 1;
|
||||
if(!result.sign() && (result.limbs()[0] < cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1>::max_limb_value))
|
||||
++result.limbs()[0];
|
||||
else if(result.sign() && result.limbs()[0])
|
||||
--result.limbs()[0];
|
||||
else
|
||||
eval_add(result, one);
|
||||
}
|
||||
template <unsigned MinBits1, unsigned MaxBits1, cpp_integer_type SignType1, cpp_int_check_type Checked1, class Allocator1>
|
||||
BOOST_MP_FORCEINLINE typename enable_if_c<!is_trivial_cpp_int<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value>::type
|
||||
eval_decrement(cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1>& result) BOOST_MP_NOEXCEPT_IF((is_non_throwing_cpp_int<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value))
|
||||
{
|
||||
static const limb_type one = 1;
|
||||
if(!result.sign() && result.limbs()[0])
|
||||
--result.limbs()[0];
|
||||
else if(result.sign() && (result.limbs()[0] < cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1>::max_limb_value))
|
||||
++result.limbs()[0];
|
||||
else
|
||||
eval_subtract(result, one);
|
||||
}
|
||||
template <unsigned MinBits1, unsigned MaxBits1, cpp_integer_type SignType1, cpp_int_check_type Checked1, class Allocator1, unsigned MinBits2, unsigned MaxBits2, cpp_integer_type SignType2, cpp_int_check_type Checked2, class Allocator2>
|
||||
BOOST_MP_FORCEINLINE typename enable_if_c<!is_trivial_cpp_int<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value && !is_trivial_cpp_int<cpp_int_backend<MinBits2, MaxBits2, SignType2, Checked2, Allocator2> >::value >::type
|
||||
eval_subtract(
|
||||
cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1>& result,
|
||||
const cpp_int_backend<MinBits2, MaxBits2, SignType2, Checked2, Allocator2>& o) BOOST_MP_NOEXCEPT_IF((is_non_throwing_cpp_int<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value))
|
||||
{
|
||||
eval_subtract(result, result, o);
|
||||
}
|
||||
template <unsigned MinBits1, unsigned MaxBits1, cpp_integer_type SignType1, cpp_int_check_type Checked1, class Allocator1, unsigned MinBits2, unsigned MaxBits2, cpp_integer_type SignType2, cpp_int_check_type Checked2, class Allocator2, unsigned MinBits3, unsigned MaxBits3, cpp_integer_type SignType3, cpp_int_check_type Checked3, class Allocator3>
|
||||
BOOST_MP_FORCEINLINE typename enable_if_c<!is_trivial_cpp_int<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value && !is_trivial_cpp_int<cpp_int_backend<MinBits2, MaxBits2, SignType2, Checked2, Allocator2> >::value && !is_trivial_cpp_int<cpp_int_backend<MinBits3, MaxBits3, SignType3, Checked3, Allocator3> >::value >::type
|
||||
eval_subtract(
|
||||
cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1>& result,
|
||||
const cpp_int_backend<MinBits2, MaxBits2, SignType2, Checked2, Allocator2>& a,
|
||||
const cpp_int_backend<MinBits3, MaxBits3, SignType3, Checked3, Allocator3>& b) BOOST_MP_NOEXCEPT_IF((is_non_throwing_cpp_int<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value))
|
||||
{
|
||||
if(a.sign() != b.sign())
|
||||
{
|
||||
add_unsigned(result, a, b);
|
||||
return;
|
||||
}
|
||||
subtract_unsigned(result, a, b);
|
||||
}
|
||||
|
||||
//
|
||||
// Simple addition and subtraction routine for trivial cpp_int's come last:
|
||||
//
|
||||
// One of the arguments is signed:
|
||||
//
|
||||
template <unsigned MinBits1, unsigned MaxBits1, cpp_integer_type SignType1, cpp_int_check_type Checked1, class Allocator1>
|
||||
inline typename enable_if_c<
|
||||
is_trivial_cpp_int<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value
|
||||
&& is_trivial_cpp_int<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value
|
||||
&& (is_signed_number<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value || is_signed_number<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value)
|
||||
>::type
|
||||
eval_add(
|
||||
cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1>& result,
|
||||
const cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1>& o) BOOST_MP_NOEXCEPT_IF((is_non_throwing_cpp_int<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value))
|
||||
{
|
||||
if(result.sign() != o.sign())
|
||||
{
|
||||
if(*o.limbs() > *result.limbs())
|
||||
{
|
||||
*result.limbs() = detail::checked_subtract(*o.limbs(), *result.limbs(), typename cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1>::checked_type());
|
||||
result.negate();
|
||||
}
|
||||
else
|
||||
*result.limbs() = detail::checked_subtract(*result.limbs(), *o.limbs(), typename cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1>::checked_type());
|
||||
}
|
||||
else
|
||||
*result.limbs() = detail::checked_add(*result.limbs(), *o.limbs(), typename cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1>::checked_type());
|
||||
result.normalize();
|
||||
}
|
||||
// Simple version for two unsigned arguments:
|
||||
template <unsigned MinBits1, unsigned MaxBits1, cpp_integer_type SignType1, cpp_int_check_type Checked1, class Allocator1>
|
||||
BOOST_MP_FORCEINLINE typename enable_if_c<
|
||||
is_trivial_cpp_int<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value
|
||||
&& is_trivial_cpp_int<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value
|
||||
&& is_unsigned_number<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value
|
||||
&& is_unsigned_number<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value
|
||||
>::type
|
||||
eval_add(cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1>& result,
|
||||
const cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1>& o) BOOST_MP_NOEXCEPT_IF((is_non_throwing_cpp_int<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value))
|
||||
{
|
||||
*result.limbs() = detail::checked_add(*result.limbs(), *o.limbs(), typename cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1>::checked_type());
|
||||
result.normalize();
|
||||
}
|
||||
|
||||
// signed subtraction:
|
||||
template <unsigned MinBits1, unsigned MaxBits1, cpp_integer_type SignType1, cpp_int_check_type Checked1, class Allocator1>
|
||||
inline typename enable_if_c<
|
||||
is_trivial_cpp_int<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value
|
||||
&& is_trivial_cpp_int<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value
|
||||
&& (is_signed_number<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value || is_signed_number<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value)
|
||||
>::type
|
||||
eval_subtract(
|
||||
cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1>& result,
|
||||
const cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1>& o) BOOST_MP_NOEXCEPT_IF((is_non_throwing_cpp_int<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value))
|
||||
{
|
||||
if(result.sign() != o.sign())
|
||||
{
|
||||
*result.limbs() = detail::checked_add(*result.limbs(), *o.limbs(), typename cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1>::checked_type());
|
||||
}
|
||||
else if(*result.limbs() < *o.limbs())
|
||||
{
|
||||
*result.limbs() = detail::checked_subtract(*o.limbs(), *result.limbs(), typename cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1>::checked_type());
|
||||
result.negate();
|
||||
}
|
||||
else
|
||||
*result.limbs() = detail::checked_subtract(*result.limbs(), *o.limbs(), typename cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1>::checked_type());
|
||||
result.normalize();
|
||||
}
|
||||
|
||||
template <unsigned MinBits1, unsigned MaxBits1, cpp_integer_type SignType1, cpp_int_check_type Checked1, class Allocator1>
|
||||
BOOST_MP_FORCEINLINE typename enable_if_c<
|
||||
is_trivial_cpp_int<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value
|
||||
&& is_trivial_cpp_int<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value
|
||||
&& is_unsigned_number<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value
|
||||
&& is_unsigned_number<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value
|
||||
>::type
|
||||
eval_subtract(
|
||||
cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1>& result,
|
||||
const cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1>& o) BOOST_MP_NOEXCEPT_IF((is_non_throwing_cpp_int<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value))
|
||||
{
|
||||
*result.limbs() = detail::checked_subtract(*result.limbs(), *o.limbs(), typename cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1>::checked_type());
|
||||
result.normalize();
|
||||
}
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
}}} // namespaces
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,42 @@
|
||||
// Copyright David Abrahams 2002.
|
||||
// Distributed under the Boost Software License, Version 1.0. (See
|
||||
// accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
#ifndef VOID_RETURN_DWA200274_HPP
|
||||
# define VOID_RETURN_DWA200274_HPP
|
||||
|
||||
# include <boost/config.hpp>
|
||||
|
||||
namespace boost { namespace python { namespace detail {
|
||||
|
||||
struct void_return
|
||||
{
|
||||
void_return() {}
|
||||
private:
|
||||
void operator=(void_return const&);
|
||||
};
|
||||
|
||||
template <class T>
|
||||
struct returnable
|
||||
{
|
||||
typedef T type;
|
||||
};
|
||||
|
||||
# ifdef BOOST_NO_VOID_RETURNS
|
||||
template <>
|
||||
struct returnable<void>
|
||||
{
|
||||
typedef void_return type;
|
||||
};
|
||||
|
||||
# ifndef BOOST_NO_CV_VOID_SPECIALIZATIONS
|
||||
template <> struct returnable<const void> : returnable<void> {};
|
||||
template <> struct returnable<volatile void> : returnable<void> {};
|
||||
template <> struct returnable<const volatile void> : returnable<void> {};
|
||||
# endif
|
||||
|
||||
# endif // BOOST_NO_VOID_RETURNS
|
||||
|
||||
}}} // namespace boost::python::detail
|
||||
|
||||
#endif // VOID_RETURN_DWA200274_HPP
|
||||
@@ -0,0 +1,135 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (c) 1998-2002
|
||||
* John Maddock
|
||||
*
|
||||
* Use, modification and distribution are subject to the
|
||||
* Boost Software License, Version 1.0. (See accompanying file
|
||||
* LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* LOCATION: see http://www.boost.org for most recent version.
|
||||
* FILE iterator_traits.cpp
|
||||
* VERSION see <boost/version.hpp>
|
||||
* DESCRIPTION: Declares iterator traits workarounds.
|
||||
*/
|
||||
|
||||
#ifndef BOOST_REGEX_V4_ITERATOR_TRAITS_HPP
|
||||
#define BOOST_REGEX_V4_ITERATOR_TRAITS_HPP
|
||||
|
||||
#ifdef BOOST_MSVC
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable: 4103)
|
||||
#endif
|
||||
#ifdef BOOST_HAS_ABI_HEADERS
|
||||
# include BOOST_ABI_PREFIX
|
||||
#endif
|
||||
#ifdef BOOST_MSVC
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
namespace boost{
|
||||
namespace BOOST_REGEX_DETAIL_NS{
|
||||
|
||||
#if defined(BOOST_NO_STD_ITERATOR_TRAITS)
|
||||
|
||||
template <class T>
|
||||
struct regex_iterator_traits
|
||||
{
|
||||
typedef typename T::iterator_category iterator_category;
|
||||
typedef typename T::value_type value_type;
|
||||
#if !defined(BOOST_NO_STD_ITERATOR)
|
||||
typedef typename T::difference_type difference_type;
|
||||
typedef typename T::pointer pointer;
|
||||
typedef typename T::reference reference;
|
||||
#else
|
||||
typedef std::ptrdiff_t difference_type;
|
||||
typedef value_type* pointer;
|
||||
typedef value_type& reference;
|
||||
#endif
|
||||
};
|
||||
|
||||
template <class T>
|
||||
struct pointer_iterator_traits
|
||||
{
|
||||
typedef std::ptrdiff_t difference_type;
|
||||
typedef T value_type;
|
||||
typedef T* pointer;
|
||||
typedef T& reference;
|
||||
typedef std::random_access_iterator_tag iterator_category;
|
||||
};
|
||||
template <class T>
|
||||
struct const_pointer_iterator_traits
|
||||
{
|
||||
typedef std::ptrdiff_t difference_type;
|
||||
typedef T value_type;
|
||||
typedef const T* pointer;
|
||||
typedef const T& reference;
|
||||
typedef std::random_access_iterator_tag iterator_category;
|
||||
};
|
||||
|
||||
template<>
|
||||
struct regex_iterator_traits<char*> : pointer_iterator_traits<char>{};
|
||||
template<>
|
||||
struct regex_iterator_traits<const char*> : const_pointer_iterator_traits<char>{};
|
||||
template<>
|
||||
struct regex_iterator_traits<wchar_t*> : pointer_iterator_traits<wchar_t>{};
|
||||
template<>
|
||||
struct regex_iterator_traits<const wchar_t*> : const_pointer_iterator_traits<wchar_t>{};
|
||||
//
|
||||
// the follwoing are needed for ICU support:
|
||||
//
|
||||
template<>
|
||||
struct regex_iterator_traits<unsigned char*> : pointer_iterator_traits<char>{};
|
||||
template<>
|
||||
struct regex_iterator_traits<const unsigned char*> : const_pointer_iterator_traits<char>{};
|
||||
template<>
|
||||
struct regex_iterator_traits<int*> : pointer_iterator_traits<int>{};
|
||||
template<>
|
||||
struct regex_iterator_traits<const int*> : const_pointer_iterator_traits<int>{};
|
||||
|
||||
#ifdef BOOST_REGEX_HAS_OTHER_WCHAR_T
|
||||
template<>
|
||||
struct regex_iterator_traits<unsigned short*> : pointer_iterator_traits<unsigned short>{};
|
||||
template<>
|
||||
struct regex_iterator_traits<const unsigned short*> : const_pointer_iterator_traits<unsigned short>{};
|
||||
#endif
|
||||
|
||||
#if defined(__SGI_STL_PORT) && defined(__STL_DEBUG)
|
||||
template<>
|
||||
struct regex_iterator_traits<std::string::iterator> : pointer_iterator_traits<char>{};
|
||||
template<>
|
||||
struct regex_iterator_traits<std::string::const_iterator> : const_pointer_iterator_traits<char>{};
|
||||
#ifndef BOOST_NO_STD_WSTRING
|
||||
template<>
|
||||
struct regex_iterator_traits<std::wstring::iterator> : pointer_iterator_traits<wchar_t>{};
|
||||
template<>
|
||||
struct regex_iterator_traits<std::wstring::const_iterator> : const_pointer_iterator_traits<wchar_t>{};
|
||||
#endif // BOOST_NO_WSTRING
|
||||
#endif // stport
|
||||
|
||||
#else
|
||||
|
||||
template <class T>
|
||||
struct regex_iterator_traits : public std::iterator_traits<T> {};
|
||||
|
||||
#endif
|
||||
|
||||
} // namespace BOOST_REGEX_DETAIL_NS
|
||||
} // namespace boost
|
||||
|
||||
#ifdef BOOST_MSVC
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable: 4103)
|
||||
#endif
|
||||
#ifdef BOOST_HAS_ABI_HEADERS
|
||||
# include BOOST_ABI_SUFFIX
|
||||
#endif
|
||||
#ifdef BOOST_MSVC
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2011 Joel de Guzman
|
||||
Copyright (c) 2009 Christopher Schmidt
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
==============================================================================*/
|
||||
|
||||
#ifndef BOOST_FUSION_CONTAINER_SET_DETAIL_END_IMPL_HPP
|
||||
#define BOOST_FUSION_CONTAINER_SET_DETAIL_END_IMPL_HPP
|
||||
|
||||
#include <boost/fusion/support/config.hpp>
|
||||
#include <boost/fusion/iterator/basic_iterator.hpp>
|
||||
|
||||
namespace boost { namespace fusion { namespace extension
|
||||
{
|
||||
template <typename>
|
||||
struct end_impl;
|
||||
|
||||
template <>
|
||||
struct end_impl<set_tag>
|
||||
{
|
||||
template <typename Seq>
|
||||
struct apply
|
||||
{
|
||||
typedef
|
||||
basic_iterator<
|
||||
set_iterator_tag
|
||||
, typename Seq::category
|
||||
, Seq
|
||||
, Seq::size::value
|
||||
>
|
||||
type;
|
||||
|
||||
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
static type
|
||||
call(Seq& seq)
|
||||
{
|
||||
return type(seq,0);
|
||||
}
|
||||
};
|
||||
};
|
||||
}}}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,263 @@
|
||||
/* Reed-Solomon decoder
|
||||
* Copyright 2002 Phil Karn, KA9Q
|
||||
* May be used under the terms of the GNU General Public License (GPL)
|
||||
*/
|
||||
|
||||
#ifdef DEBUG
|
||||
#include <stdio.h>
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#define min(a,b) ((a) < (b) ? (a) : (b))
|
||||
|
||||
#ifdef FIXED
|
||||
#include "fixed.h"
|
||||
#elif defined(BIGSYM)
|
||||
#include "int.h"
|
||||
#else
|
||||
#include "char.h"
|
||||
#endif
|
||||
|
||||
int DECODE_RS(
|
||||
#ifdef FIXED
|
||||
DTYPE *data, int *eras_pos, int no_eras,int pad){
|
||||
#else
|
||||
void *p,DTYPE *data, int *eras_pos, int no_eras){
|
||||
struct rs *rs = (struct rs *)p;
|
||||
#endif
|
||||
int deg_lambda, el, deg_omega;
|
||||
int i, j, r,k;
|
||||
DTYPE u,q,tmp,num1,num2,den,discr_r;
|
||||
DTYPE lambda[NROOTS+1], s[NROOTS]; /* Err+Eras Locator poly
|
||||
* and syndrome poly */
|
||||
DTYPE b[NROOTS+1], t[NROOTS+1], omega[NROOTS+1];
|
||||
DTYPE root[NROOTS], reg[NROOTS+1], loc[NROOTS];
|
||||
int syn_error, count;
|
||||
|
||||
#ifdef FIXED
|
||||
/* Check pad parameter for validity */
|
||||
if(pad < 0 || pad >= NN)
|
||||
return -1;
|
||||
#endif
|
||||
|
||||
/* form the syndromes; i.e., evaluate data(x) at roots of g(x) */
|
||||
for(i=0;i<NROOTS;i++)
|
||||
s[i] = data[0];
|
||||
|
||||
for(j=1;j<NN-PAD;j++){
|
||||
for(i=0;i<NROOTS;i++){
|
||||
if(s[i] == 0){
|
||||
s[i] = data[j];
|
||||
} else {
|
||||
s[i] = data[j] ^ ALPHA_TO[MODNN(INDEX_OF[s[i]] + (FCR+i)*PRIM)];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Convert syndromes to index form, checking for nonzero condition */
|
||||
syn_error = 0;
|
||||
for(i=0;i<NROOTS;i++){
|
||||
syn_error |= s[i];
|
||||
s[i] = INDEX_OF[s[i]];
|
||||
}
|
||||
|
||||
if (!syn_error) {
|
||||
/* if syndrome is zero, data[] is a codeword and there are no
|
||||
* errors to correct. So return data[] unmodified
|
||||
*/
|
||||
count = 0;
|
||||
goto finish;
|
||||
}
|
||||
memset(&lambda[1],0,NROOTS*sizeof(lambda[0]));
|
||||
lambda[0] = 1;
|
||||
|
||||
if (no_eras > 0) {
|
||||
/* Init lambda to be the erasure locator polynomial */
|
||||
lambda[1] = ALPHA_TO[MODNN(PRIM*(NN-1-eras_pos[0]))];
|
||||
for (i = 1; i < no_eras; i++) {
|
||||
u = MODNN(PRIM*(NN-1-eras_pos[i]));
|
||||
for (j = i+1; j > 0; j--) {
|
||||
tmp = INDEX_OF[lambda[j - 1]];
|
||||
if(tmp != A0)
|
||||
lambda[j] ^= ALPHA_TO[MODNN(u + tmp)];
|
||||
}
|
||||
}
|
||||
|
||||
#if DEBUG >= 1
|
||||
/* Test code that verifies the erasure locator polynomial just constructed
|
||||
Needed only for decoder debugging. */
|
||||
|
||||
/* find roots of the erasure location polynomial */
|
||||
for(i=1;i<=no_eras;i++)
|
||||
reg[i] = INDEX_OF[lambda[i]];
|
||||
|
||||
count = 0;
|
||||
for (i = 1,k=IPRIM-1; i <= NN; i++,k = MODNN(k+IPRIM)) {
|
||||
q = 1;
|
||||
for (j = 1; j <= no_eras; j++)
|
||||
if (reg[j] != A0) {
|
||||
reg[j] = MODNN(reg[j] + j);
|
||||
q ^= ALPHA_TO[reg[j]];
|
||||
}
|
||||
if (q != 0)
|
||||
continue;
|
||||
/* store root and error location number indices */
|
||||
root[count] = i;
|
||||
loc[count] = k;
|
||||
count++;
|
||||
}
|
||||
if (count != no_eras) {
|
||||
printf("count = %d no_eras = %d\n lambda(x) is WRONG\n",count,no_eras);
|
||||
count = -1;
|
||||
goto finish;
|
||||
}
|
||||
#if DEBUG >= 2
|
||||
printf("\n Erasure positions as determined by roots of Eras Loc Poly:\n");
|
||||
for (i = 0; i < count; i++)
|
||||
printf("%d ", loc[i]);
|
||||
printf("\n");
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
for(i=0;i<NROOTS+1;i++)
|
||||
// printf("%d %d %d\n",i,lambda[i],INDEX_OF[lambda[i]]);
|
||||
b[i] = INDEX_OF[lambda[i]];
|
||||
|
||||
/*
|
||||
* Begin Berlekamp-Massey algorithm to determine error+erasure
|
||||
* locator polynomial
|
||||
*/
|
||||
r = no_eras;
|
||||
el = no_eras;
|
||||
while (++r <= NROOTS) { /* r is the step number */
|
||||
/* Compute discrepancy at the r-th step in poly-form */
|
||||
discr_r = 0;
|
||||
for (i = 0; i < r; i++){
|
||||
if ((lambda[i] != 0) && (s[r-i-1] != A0)) {
|
||||
discr_r ^= ALPHA_TO[MODNN(INDEX_OF[lambda[i]] + s[r-i-1])];
|
||||
}
|
||||
}
|
||||
discr_r = INDEX_OF[discr_r]; /* Index form */
|
||||
if (discr_r == A0) {
|
||||
/* 2 lines below: B(x) <-- x*B(x) */
|
||||
memmove(&b[1],b,NROOTS*sizeof(b[0]));
|
||||
b[0] = A0;
|
||||
} else {
|
||||
/* 7 lines below: T(x) <-- lambda(x) - discr_r*x*b(x) */
|
||||
t[0] = lambda[0];
|
||||
for (i = 0 ; i < NROOTS; i++) {
|
||||
if(b[i] != A0)
|
||||
t[i+1] = lambda[i+1] ^ ALPHA_TO[MODNN(discr_r + b[i])];
|
||||
else
|
||||
t[i+1] = lambda[i+1];
|
||||
}
|
||||
if (2 * el <= r + no_eras - 1) {
|
||||
el = r + no_eras - el;
|
||||
/*
|
||||
* 2 lines below: B(x) <-- inv(discr_r) *
|
||||
* lambda(x)
|
||||
*/
|
||||
for (i = 0; i <= NROOTS; i++)
|
||||
b[i] = (lambda[i] == 0) ? A0 : MODNN(INDEX_OF[lambda[i]] - discr_r + NN);
|
||||
} else {
|
||||
/* 2 lines below: B(x) <-- x*B(x) */
|
||||
memmove(&b[1],b,NROOTS*sizeof(b[0]));
|
||||
b[0] = A0;
|
||||
}
|
||||
memcpy(lambda,t,(NROOTS+1)*sizeof(t[0]));
|
||||
}
|
||||
}
|
||||
|
||||
/* Convert lambda to index form and compute deg(lambda(x)) */
|
||||
deg_lambda = 0;
|
||||
for(i=0;i<NROOTS+1;i++){
|
||||
lambda[i] = INDEX_OF[lambda[i]];
|
||||
if(lambda[i] != A0)
|
||||
deg_lambda = i;
|
||||
}
|
||||
/* Find roots of the error+erasure locator polynomial by Chien search */
|
||||
memcpy(®[1],&lambda[1],NROOTS*sizeof(reg[0]));
|
||||
count = 0; /* Number of roots of lambda(x) */
|
||||
for (i = 1,k=IPRIM-1; i <= NN; i++,k = MODNN(k+IPRIM)) {
|
||||
q = 1; /* lambda[0] is always 0 */
|
||||
for (j = deg_lambda; j > 0; j--){
|
||||
if (reg[j] != A0) {
|
||||
reg[j] = MODNN(reg[j] + j);
|
||||
q ^= ALPHA_TO[reg[j]];
|
||||
}
|
||||
}
|
||||
if (q != 0)
|
||||
continue; /* Not a root */
|
||||
/* store root (index-form) and error location number */
|
||||
#if DEBUG>=2
|
||||
printf("count %d root %d loc %d\n",count,i,k);
|
||||
#endif
|
||||
root[count] = i;
|
||||
loc[count] = k;
|
||||
/* If we've already found max possible roots,
|
||||
* abort the search to save time
|
||||
*/
|
||||
if(++count == deg_lambda)
|
||||
break;
|
||||
}
|
||||
if (deg_lambda != count) {
|
||||
/*
|
||||
* deg(lambda) unequal to number of roots => uncorrectable
|
||||
* error detected
|
||||
*/
|
||||
count = -1;
|
||||
goto finish;
|
||||
}
|
||||
/*
|
||||
* Compute err+eras evaluator poly omega(x) = s(x)*lambda(x) (modulo
|
||||
* x**NROOTS). in index form. Also find deg(omega).
|
||||
*/
|
||||
deg_omega = deg_lambda-1;
|
||||
for (i = 0; i <= deg_omega;i++){
|
||||
tmp = 0;
|
||||
for(j=i;j >= 0; j--){
|
||||
if ((s[i - j] != A0) && (lambda[j] != A0))
|
||||
tmp ^= ALPHA_TO[MODNN(s[i - j] + lambda[j])];
|
||||
}
|
||||
omega[i] = INDEX_OF[tmp];
|
||||
}
|
||||
|
||||
/*
|
||||
* Compute error values in poly-form. num1 = omega(inv(X(l))), num2 =
|
||||
* inv(X(l))**(FCR-1) and den = lambda_pr(inv(X(l))) all in poly-form
|
||||
*/
|
||||
for (j = count-1; j >=0; j--) {
|
||||
num1 = 0;
|
||||
for (i = deg_omega; i >= 0; i--) {
|
||||
if (omega[i] != A0)
|
||||
num1 ^= ALPHA_TO[MODNN(omega[i] + i * root[j])];
|
||||
}
|
||||
num2 = ALPHA_TO[MODNN(root[j] * (FCR - 1) + NN)];
|
||||
den = 0;
|
||||
|
||||
/* lambda[i+1] for i even is the formal derivative lambda_pr of lambda[i] */
|
||||
for (i = min(deg_lambda,NROOTS-1) & ~1; i >= 0; i -=2) {
|
||||
if(lambda[i+1] != A0)
|
||||
den ^= ALPHA_TO[MODNN(lambda[i+1] + i * root[j])];
|
||||
}
|
||||
#if DEBUG >= 1
|
||||
if (den == 0) {
|
||||
printf("\n ERROR: denominator = 0\n");
|
||||
count = -1;
|
||||
goto finish;
|
||||
}
|
||||
#endif
|
||||
/* Apply error to data */
|
||||
if (num1 != 0 && loc[j] >= PAD) {
|
||||
data[loc[j]-PAD] ^= ALPHA_TO[MODNN(INDEX_OF[num1] + INDEX_OF[num2] + NN - INDEX_OF[den])];
|
||||
}
|
||||
}
|
||||
finish:
|
||||
if(eras_pos != NULL){
|
||||
for(i=0;i<count;i++)
|
||||
eras_pos[i] = loc[i];
|
||||
}
|
||||
return count;
|
||||
}
|
||||
Reference in New Issue
Block a user