31#if defined(IntegerConverter_RECURSES)
32#error Recursive header files inclusion detected in IntegerConverter.h
35#define IntegerConverter_RECURSES
37#if !defined IntegerConverter_h
39#define IntegerConverter_h
47#include "DGtal/base/Common.h"
48#include "DGtal/kernel/CInteger.h"
49#include "DGtal/kernel/NumberTraits.h"
50#include "DGtal/kernel/PointVector.h"
62 mpz_set_si(n, (
int)(sll >> 32));
63 mpz_mul_2exp(n, n, 32 );
64 mpz_add_ui(n, n, (
unsigned int)sll);
71 mpz_set_ui(n, (
unsigned int)(ull >> 32));
72 mpz_mul_2exp(n, n, 32);
73 mpz_add_ui(n, n, (
unsigned int)ull);
84 mpz_mod_2exp( tmp, n, 64 );
85 lo = mpz_get_ui( tmp );
86 mpz_div_2exp( tmp, tmp, 32 );
87 hi = mpz_get_ui( tmp );
89 return (((
unsigned long long)hi) << 32) + lo;
149 template < DGtal::Dimension dim >
177 trace.
warning() <<
"Bad integer conversion: " << i <<
" -> " << r
192 q[ i ] =
cast( p[ i ] );
196#ifdef WITH_BIGINTEGER
203 trace.
warning() <<
"Bad integer conversion: " << i <<
" -> " << r
218 q[ i ] =
cast( p[ i ] );
235 template < DGtal::Dimension dim >
256 q[ i ] =
cast( p[ i ] );
278#ifdef WITH_BIGINTEGER
287 trace.
warning() <<
"Bad integer conversion: " << i <<
" -> " << r
302 q[ i ] =
cast( p[ i ] );
310#ifdef WITH_BIGINTEGER
320 template < DGtal::Dimension dim >
341 q[ i ] =
cast( p[ i ] );
364 q[ i ] =
cast( p[ i ] );
394#undef IntegerConverter_RECURSES
static void mpz_set_sll(mpz_t n, long long sll)
----------— GMP SPECIALIZED SERVICES -------------------------—
static long long mpz_get_sll(mpz_t n)
static unsigned long long mpz_get_ull(mpz_t n)
static void mpz_set_ull(mpz_t n, unsigned long long ull)
DGtal is the top-level namespace which contains all DGtal functions and types.
boost::int64_t int64_t
signed 94-bit integer.
DGtal::uint32_t Dimension
boost::int32_t int32_t
signed 32-bit integer.
mpz_class BigInteger
Multi-precision integer with GMP implementation.
static PointVector< dim, DGtal::BigInteger > cast(PointVector< dim, DGtal::BigInteger > p)
static DGtal::BigInteger cast(DGtal::int32_t i)
static PointVector< dim, DGtal::BigInteger > cast(PointVector< dim, DGtal::int32_t > p)
static PointVector< dim, DGtal::BigInteger > cast(PointVector< dim, DGtal::int64_t > p)
static DGtal::BigInteger cast(DGtal::BigInteger i)
static DGtal::BigInteger cast(DGtal::int64_t i)
DGtal::BigInteger Integer
static DGtal::int32_t cast(DGtal::int32_t i)
static PointVector< dim, DGtal::int32_t > cast(PointVector< dim, DGtal::int64_t > p)
static PointVector< dim, DGtal::int32_t > cast(PointVector< dim, DGtal::BigInteger > p)
static DGtal::int32_t cast(DGtal::BigInteger i)
static PointVector< dim, DGtal::int32_t > cast(PointVector< dim, DGtal::int32_t > p)
static DGtal::int32_t cast(DGtal::int64_t i)
static DGtal::int64_t cast(DGtal::int32_t i)
static PointVector< dim, DGtal::int64_t > cast(PointVector< dim, DGtal::int64_t > p)
static DGtal::int64_t cast(DGtal::int64_t i)
static PointVector< dim, DGtal::int64_t > cast(PointVector< dim, DGtal::BigInteger > p)
static PointVector< dim, DGtal::int64_t > cast(PointVector< dim, DGtal::int32_t > p)
static DGtal::int64_t cast(DGtal::BigInteger i)
----------— INTEGER/POINT CONVERSION SERVICES -----------------—
BOOST_CONCEPT_ASSERT((concepts::CInteger< TInteger >))
static PointVector< dim, Integer > cast(PointVector< dim, Integer > p)
static Integer cast(Integer i)
Aim: Concept checking for Integer Numbers. More precisely, this concept is a refinement of both CEucl...