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);
69 static inline void mpz_set_ull(mpz_t n,
unsigned long long ull)
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);
83 mpz_mod_2exp( tmp, n, 64 );
84 auto lo = mpz_get_ui( tmp );
85 mpz_div_2exp( tmp, tmp, 32 );
86 auto hi = mpz_get_ui( tmp );
88 return (((
unsigned long long)hi) << 32) + lo;
148 template < DGtal::Dimension dim >
176 trace.
warning() <<
"Bad integer conversion: " << i <<
" -> " << r
191 q[ i ] =
cast( p[ i ] );
195#ifdef WITH_BIGINTEGER
202 trace.
warning() <<
"Bad integer conversion: " << i <<
" -> " << r
217 q[ i ] =
cast( p[ i ] );
234 template < DGtal::Dimension dim >
255 q[ i ] =
cast( p[ i ] );
277#ifdef WITH_BIGINTEGER
286 trace.
warning() <<
"Bad integer conversion: " << i <<
" -> " << r
301 q[ i ] =
cast( p[ i ] );
309#ifdef WITH_BIGINTEGER
319 template < DGtal::Dimension dim >
340 q[ i ] =
cast( p[ i ] );
363 q[ i ] =
cast( p[ i ] );
393#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...