Macros | Functions | Variables
imm.h File Reference

operations on immediates, that is elements of F_p, GF, Z, Q that fit into intrinsic int, long More...

#include <stdint.h>
#include <iostream>
#include "cf_assert.h"
#include "cf_defs.h"
#include "cf_globals.h"
#include "ffops.h"
#include "gfops.h"
#include "cf_factory.h"
#include "canonicalform.h"
#include "int_cf.h"

Go to the source code of this file.

Macros

#define OSTREAM   std::ostream
 

Functions

long imm2int (const InternalCF *const imm)
 
InternalCFint2imm (long i)
 
InternalCFint2imm_p (long i)
 
InternalCFint2imm_gf (long i)
 
int imm_isone (const InternalCF *const ptr)
 
int imm_isone_p (const InternalCF *const ptr)
 
int imm_isone_gf (const InternalCF *const ptr)
 
int imm_iszero (const InternalCF *const ptr)
 
int imm_iszero_p (const InternalCF *const ptr)
 
int imm_iszero_gf (const InternalCF *const ptr)
 
long imm_intval (const InternalCF *const op)
 
int imm_sign (const InternalCF *const op)
 imm_sign() - return sign of immediate object. More...
 
int imm_cmp (const InternalCF *const lhs, const InternalCF *const rhs)
 imm_cmp(), imm_cmp_p(), imm_cmp_gf() - compare immediate objects. More...
 
int imm_cmp_p (const InternalCF *const lhs, const InternalCF *const rhs)
 
int imm_cmp_gf (const InternalCF *const lhs, const InternalCF *const rhs)
 
InternalCFimm_add (const InternalCF *const lhs, const InternalCF *const rhs)
 
InternalCFimm_add_p (const InternalCF *const lhs, const InternalCF *const rhs)
 
InternalCFimm_add_gf (const InternalCF *const lhs, const InternalCF *const rhs)
 
InternalCFimm_sub (const InternalCF *const lhs, const InternalCF *const rhs)
 
InternalCFimm_sub_p (const InternalCF *const lhs, const InternalCF *const rhs)
 
InternalCFimm_sub_gf (const InternalCF *const lhs, const InternalCF *const rhs)
 
InternalCFimm_mul (InternalCF *lhs, InternalCF *rhs)
 
InternalCFimm_mul_p (const InternalCF *const lhs, const InternalCF *const rhs)
 
InternalCFimm_mul_gf (const InternalCF *const lhs, const InternalCF *const rhs)
 
InternalCFimm_div (const InternalCF *const lhs, const InternalCF *const rhs)
 
InternalCFimm_divrat (const InternalCF *const lhs, const InternalCF *const rhs)
 
InternalCFimm_div_p (const InternalCF *const lhs, const InternalCF *const rhs)
 
InternalCFimm_div_gf (const InternalCF *const lhs, const InternalCF *const rhs)
 
InternalCFimm_mod (const InternalCF *const lhs, const InternalCF *const rhs)
 
InternalCFimm_mod_p (const InternalCF *const, const InternalCF *const)
 
InternalCFimm_mod_gf (const InternalCF *const, const InternalCF *const)
 
void imm_divrem (const InternalCF *const lhs, const InternalCF *const rhs, InternalCF *&q, InternalCF *&r)
 
void imm_divrem_p (const InternalCF *const lhs, const InternalCF *const rhs, InternalCF *&q, InternalCF *&r)
 
void imm_divrem_gf (const InternalCF *const lhs, const InternalCF *const rhs, InternalCF *&q, InternalCF *&r)
 
InternalCFimm_neg (const InternalCF *const op)
 
InternalCFimm_neg_p (const InternalCF *const op)
 
InternalCFimm_neg_gf (const InternalCF *const op)
 
void imm_print (OSTREAM &os, const InternalCF *const op, const char *const str)
 

Variables

const long INTMARK = 1
 
const long FFMARK = 2
 
const long GFMARK = 3
 
const long MINIMMEDIATE = -(1L<<60)+2L
 
const long MAXIMMEDIATE = (1L<<60)-2L
 
const FACTORY_INT64 MINIMMEDIATELL = -268435454LL
 
const FACTORY_INT64 MAXIMMEDIATELL = 268435454LL
 

Detailed Description

operations on immediates, that is elements of F_p, GF, Z, Q that fit into intrinsic int, long

Definition in file imm.h.

Macro Definition Documentation

§ OSTREAM

#define OSTREAM   std::ostream

Definition at line 20 of file imm.h.

Function Documentation

§ imm2int()

long imm2int ( const InternalCF *const  imm)
inline

Definition at line 66 of file imm.h.

67 {
68  return ((intptr_t)imm) >> 2;
69 }

§ imm_add()

InternalCF* imm_add ( const InternalCF *const  lhs,
const InternalCF *const  rhs 
)
inline

Definition at line 265 of file imm.h.

266 {
267  long result = imm2int( lhs ) + imm2int( rhs );
268  if ( ( result > MAXIMMEDIATE ) || ( result < MINIMMEDIATE ) )
269  return CFFactory::basic( result );
270  else
271  return int2imm( result );
272 }
const long MINIMMEDIATE
Definition: imm.h:50
InternalCF * int2imm(long i)
Definition: imm.h:71
static InternalCF * basic(long value)
Definition: cf_factory.cc:28
long imm2int(const InternalCF *const imm)
Definition: imm.h:66
const long MAXIMMEDIATE
Definition: imm.h:51
return result
Definition: facAbsBiFact.cc:76

§ imm_add_gf()

InternalCF* imm_add_gf ( const InternalCF *const  lhs,
const InternalCF *const  rhs 
)
inline

Definition at line 279 of file imm.h.

280 {
281  return int2imm_gf( gf_add( imm2int( lhs ), imm2int( rhs ) ) );
282 }
InternalCF * int2imm_gf(long i)
Definition: imm.h:102
long imm2int(const InternalCF *const imm)
Definition: imm.h:66
int gf_add(int a, int b)
Definition: gfops.h:133

§ imm_add_p()

InternalCF* imm_add_p ( const InternalCF *const  lhs,
const InternalCF *const  rhs 
)
inline

Definition at line 274 of file imm.h.

275 {
276  return int2imm_p( ff_add( imm2int( lhs ), imm2int( rhs ) ) );
277 }
InternalCF * int2imm_p(long i)
Definition: imm.h:97
int ff_add(const int a, const int b)
Definition: ffops.h:99
long imm2int(const InternalCF *const imm)
Definition: imm.h:66

§ imm_cmp()

int imm_cmp ( const InternalCF *const  lhs,
const InternalCF *const  rhs 
)
inline

imm_cmp(), imm_cmp_p(), imm_cmp_gf() - compare immediate objects.

For immediate integers, it is clear how this should be done. For objects from finite fields, it is not clear since they are not ordered fields. However, since we want to have a total well order on polynomials we have to define a total well order on all coefficients, too. We decided to use simply the order on the representation as `int's of such objects.

See also
CanonicalForm::operator <(), CanonicalForm::operator ==()

Definition at line 230 of file imm.h.

231 {
232  if ( imm2int( lhs ) == imm2int( rhs ) )
233  return 0;
234  else if ( imm2int( lhs ) > imm2int( rhs ) )
235  return 1;
236  else
237  return -1;
238 }
long imm2int(const InternalCF *const imm)
Definition: imm.h:66

§ imm_cmp_gf()

int imm_cmp_gf ( const InternalCF *const  lhs,
const InternalCF *const  rhs 
)
inline

Definition at line 252 of file imm.h.

253 {
254  if ( imm2int( lhs ) == imm2int( rhs ) )
255  return 0;
256  // check is done in this way because zero should be minimal
257  else if ( imm2int( lhs ) > imm2int( rhs ) )
258  return -1;
259  else
260  return 1;
261 }
long imm2int(const InternalCF *const imm)
Definition: imm.h:66

§ imm_cmp_p()

int imm_cmp_p ( const InternalCF *const  lhs,
const InternalCF *const  rhs 
)
inline

Definition at line 241 of file imm.h.

242 {
243  if ( imm2int( lhs ) == imm2int( rhs ) )
244  return 0;
245  else if ( imm2int( lhs ) > imm2int( rhs ) )
246  return 1;
247  else
248  return -1;
249 }
long imm2int(const InternalCF *const imm)
Definition: imm.h:66

§ imm_div()

InternalCF* imm_div ( const InternalCF *const  lhs,
const InternalCF *const  rhs 
)
inline

Definition at line 352 of file imm.h.

353 {
354  long a = imm2int( lhs );
355  long b = imm2int( rhs );
356  if ( a > 0 )
357  return int2imm( a / b );
358  else if ( b > 0 )
359  return int2imm( -((b-a-1)/b) );
360  else
361  return int2imm( (-a-b-1)/(-b) );
362 }
const poly a
Definition: syzextra.cc:212
InternalCF * int2imm(long i)
Definition: imm.h:71
long imm2int(const InternalCF *const imm)
Definition: imm.h:66
const poly b
Definition: syzextra.cc:213

§ imm_div_gf()

InternalCF* imm_div_gf ( const InternalCF *const  lhs,
const InternalCF *const  rhs 
)
inline

Definition at line 385 of file imm.h.

386 {
387  return int2imm_gf( gf_div( imm2int( lhs ), imm2int( rhs ) ) );
388 }
int gf_div(int a, int b)
Definition: gfops.h:185
InternalCF * int2imm_gf(long i)
Definition: imm.h:102
long imm2int(const InternalCF *const imm)
Definition: imm.h:66

§ imm_div_p()

InternalCF* imm_div_p ( const InternalCF *const  lhs,
const InternalCF *const  rhs 
)
inline

Definition at line 380 of file imm.h.

381 {
382  return int2imm_p( ff_div( imm2int( lhs ), imm2int( rhs ) ) );
383 }
InternalCF * int2imm_p(long i)
Definition: imm.h:97
int ff_div(const int a, const int b)
Definition: ffops.h:163
long imm2int(const InternalCF *const imm)
Definition: imm.h:66

§ imm_divrat()

InternalCF* imm_divrat ( const InternalCF *const  lhs,
const InternalCF *const  rhs 
)
inline

Definition at line 364 of file imm.h.

365 {
366  if ( cf_glob_switches.isOn( SW_RATIONAL ) )
367  return CFFactory::rational( imm2int( lhs ), imm2int( rhs ) );
368  else {
369  long a = imm2int( lhs );
370  long b = imm2int( rhs );
371  if ( a > 0 )
372  return int2imm( a / b );
373  else if ( b > 0 )
374  return int2imm( -((b-a-1)/b) );
375  else
376  return int2imm( (-a-b-1)/(-b) );
377  }
378 }
const poly a
Definition: syzextra.cc:212
InternalCF * int2imm(long i)
Definition: imm.h:71
static InternalCF * rational(long num, long den)
Definition: cf_factory.cc:220
static const int SW_RATIONAL
set to 1 for computations over Q
Definition: cf_defs.h:28
long imm2int(const InternalCF *const imm)
Definition: imm.h:66
#define cf_glob_switches
CFSwitches cf_glob_switches;.
Definition: cf_switches.h:75
const poly b
Definition: syzextra.cc:213

§ imm_divrem()

void imm_divrem ( const InternalCF *const  lhs,
const InternalCF *const  rhs,
InternalCF *&  q,
InternalCF *&  r 
)
inline

Definition at line 424 of file imm.h.

425 {
426  if ( cf_glob_switches.isOn( SW_RATIONAL ) ) {
427  q = imm_divrat( lhs, rhs );
428  r = CFFactory::basic( 0L );
429  }
430  else {
431  q = imm_div( lhs, rhs );
432  r = imm_mod( lhs, rhs );
433  }
434 }
InternalCF * imm_mod(const InternalCF *const lhs, const InternalCF *const rhs)
Definition: imm.h:390
InternalCF * imm_div(const InternalCF *const lhs, const InternalCF *const rhs)
Definition: imm.h:352
static const int SW_RATIONAL
set to 1 for computations over Q
Definition: cf_defs.h:28
static InternalCF * basic(long value)
Definition: cf_factory.cc:28
InternalCF * imm_divrat(const InternalCF *const lhs, const InternalCF *const rhs)
Definition: imm.h:364
#define cf_glob_switches
CFSwitches cf_glob_switches;.
Definition: cf_switches.h:75

§ imm_divrem_gf()

void imm_divrem_gf ( const InternalCF *const  lhs,
const InternalCF *const  rhs,
InternalCF *&  q,
InternalCF *&  r 
)
inline

Definition at line 442 of file imm.h.

443 {
444  q = int2imm_gf( gf_div( imm2int( lhs ), imm2int( rhs ) ) );
445  r = int2imm_gf( gf_q );
446 }
int gf_div(int a, int b)
Definition: gfops.h:185
int gf_q
Definition: gfops.cc:47
InternalCF * int2imm_gf(long i)
Definition: imm.h:102
long imm2int(const InternalCF *const imm)
Definition: imm.h:66

§ imm_divrem_p()

void imm_divrem_p ( const InternalCF *const  lhs,
const InternalCF *const  rhs,
InternalCF *&  q,
InternalCF *&  r 
)
inline

Definition at line 436 of file imm.h.

437 {
438  q = int2imm_p( ff_div( imm2int( lhs ), imm2int( rhs ) ) );
439  r = int2imm_p( 0 );
440 }
InternalCF * int2imm_p(long i)
Definition: imm.h:97
int ff_div(const int a, const int b)
Definition: ffops.h:163
long imm2int(const InternalCF *const imm)
Definition: imm.h:66

§ imm_intval()

long imm_intval ( const InternalCF *const  op)
inline

Definition at line 160 of file imm.h.

161 {
162  if ( is_imm( op ) == FFMARK )
163  if ( cf_glob_switches.isOn( SW_SYMMETRIC_FF ) )
164  return ff_symmetric( imm2int( op ) );
165  else
166  return imm2int( op );
167  else if ( is_imm( op ) == GFMARK ) {
168  ASSERT( gf_isff( imm2int( op ) ), "invalid conversion" );
169  if ( cf_glob_switches.isOn( SW_SYMMETRIC_FF ) )
170  return ff_symmetric( gf_gf2ff( imm2int( op ) ) );
171  else
172  return gf_gf2ff( imm2int( op ) );
173  }
174  else
175  return imm2int( op );
176 }
const long GFMARK
Definition: imm.h:39
long gf_gf2ff(long a)
Definition: gfops.cc:226
const long FFMARK
Definition: imm.h:38
bool gf_isff(long a)
Definition: gfops.cc:270
long imm2int(const InternalCF *const imm)
Definition: imm.h:66
int is_imm(const InternalCF *const ptr)
Definition: canonicalform.h:60
#define cf_glob_switches
CFSwitches cf_glob_switches;.
Definition: cf_switches.h:75
#define ASSERT(expression, message)
Definition: cf_assert.h:99
static const int SW_SYMMETRIC_FF
set to 1 for symmetric representation over F_q
Definition: cf_defs.h:30
int ff_symmetric(const int a)
Definition: ffops.h:59

§ imm_isone()

int imm_isone ( const InternalCF *const  ptr)
inline

Definition at line 120 of file imm.h.

121 {
122  return imm2int( ptr ) == 1;
123 }
long imm2int(const InternalCF *const imm)
Definition: imm.h:66

§ imm_isone_gf()

int imm_isone_gf ( const InternalCF *const  ptr)
inline

Definition at line 132 of file imm.h.

133 {
134  return gf_isone( imm2int( ptr ) );
135 }
bool gf_isone(int a)
Definition: gfops.h:53
long imm2int(const InternalCF *const imm)
Definition: imm.h:66

§ imm_isone_p()

int imm_isone_p ( const InternalCF *const  ptr)
inline

Definition at line 126 of file imm.h.

127 {
128  return imm2int( ptr ) == 1;
129 }
long imm2int(const InternalCF *const imm)
Definition: imm.h:66

§ imm_iszero()

int imm_iszero ( const InternalCF *const  ptr)
inline

Definition at line 141 of file imm.h.

142 {
143  return imm2int( ptr ) == 0;
144 }
long imm2int(const InternalCF *const imm)
Definition: imm.h:66

§ imm_iszero_gf()

int imm_iszero_gf ( const InternalCF *const  ptr)
inline

Definition at line 153 of file imm.h.

154 {
155  return gf_iszero( imm2int( ptr ) );
156 }
bool gf_iszero(int a)
Definition: gfops.h:43
long imm2int(const InternalCF *const imm)
Definition: imm.h:66

§ imm_iszero_p()

int imm_iszero_p ( const InternalCF *const  ptr)
inline

Definition at line 147 of file imm.h.

148 {
149  return imm2int( ptr ) == 0;
150 }
long imm2int(const InternalCF *const imm)
Definition: imm.h:66

§ imm_mod()

InternalCF* imm_mod ( const InternalCF *const  lhs,
const InternalCF *const  rhs 
)
inline

Definition at line 390 of file imm.h.

391 {
392  if ( cf_glob_switches.isOn( SW_RATIONAL ) )
393  return int2imm( 0 );
394  else {
395  long a = imm2int( lhs );
396  long b = imm2int( rhs );
397  if ( a > 0 )
398  if ( b > 0 )
399  return int2imm( a % b );
400  else
401  return int2imm( a % (-b) );
402  else
403  if ( b > 0 ) {
404  long r = (-a) % b;
405  return int2imm( (r==0) ? r : b-r );
406  }
407  else {
408  long r = (-a) % (-b);
409  return int2imm( (r==0) ? r : -b-r );
410  }
411  }
412 }
const poly a
Definition: syzextra.cc:212
InternalCF * int2imm(long i)
Definition: imm.h:71
const ring r
Definition: syzextra.cc:208
static const int SW_RATIONAL
set to 1 for computations over Q
Definition: cf_defs.h:28
long imm2int(const InternalCF *const imm)
Definition: imm.h:66
#define cf_glob_switches
CFSwitches cf_glob_switches;.
Definition: cf_switches.h:75
const poly b
Definition: syzextra.cc:213

§ imm_mod_gf()

InternalCF* imm_mod_gf ( const InternalCF const,
const InternalCF const 
)
inline

Definition at line 419 of file imm.h.

420 {
421  return int2imm_gf( gf_q );
422 }
int gf_q
Definition: gfops.cc:47
InternalCF * int2imm_gf(long i)
Definition: imm.h:102

§ imm_mod_p()

InternalCF* imm_mod_p ( const InternalCF const,
const InternalCF const 
)
inline

Definition at line 414 of file imm.h.

415 {
416  return int2imm_p( 0 );
417 }
InternalCF * int2imm_p(long i)
Definition: imm.h:97

§ imm_mul()

InternalCF* imm_mul ( InternalCF lhs,
InternalCF rhs 
)
inline

Definition at line 304 of file imm.h.

305 {
306  long a = imm2int( lhs );
307  long b = imm2int( rhs );
308  int sa= 1;
309  unsigned FACTORY_INT64 aa, bb;
310  if (a < 0)
311  {
312  sa= -1;
313  aa= (unsigned FACTORY_INT64) (-a);
314  }
315  else
316  aa= (unsigned FACTORY_INT64) a;
317  if (b < 0)
318  {
319  sa= -sa;
320  bb= (unsigned FACTORY_INT64) (-b);
321  }
322  else
323  bb= (unsigned FACTORY_INT64) b;
324  unsigned FACTORY_INT64 result = aa*bb;
325  #if SIZEOF_LONG == 4
326  if (result>(unsigned FACTORY_INT64)MAXIMMEDIATE)
327  {
329  return res->mulcoeff( rhs );
330  }
331  #else
332  if ( ( a!=0L ) && ((result/aa!=bb) || (result>(unsigned FACTORY_INT64) MAXIMMEDIATE) ))
333  {
334  InternalCF * res = CFFactory::basic( IntegerDomain, a, true );
335  return res->mulcoeff( rhs );
336  }
337  #endif
338  else
339  return int2imm( sa*result );
340 }
const poly a
Definition: syzextra.cc:212
#define FACTORY_INT64
Definition: factoryconf.h:55
InternalCF * int2imm(long i)
Definition: imm.h:71
virtual class for internal CanonicalForm&#39;s
Definition: int_cf.h:39
#define IntegerDomain
Definition: cf_defs.h:25
poly res
Definition: myNF.cc:322
static InternalCF * basic(long value)
Definition: cf_factory.cc:28
long imm2int(const InternalCF *const imm)
Definition: imm.h:66
const long MAXIMMEDIATE
Definition: imm.h:51
virtual InternalCF * mulcoeff(InternalCF *) PVIRT_INTCF("mulcoeff")
const poly b
Definition: syzextra.cc:213
return result
Definition: facAbsBiFact.cc:76

§ imm_mul_gf()

InternalCF* imm_mul_gf ( const InternalCF *const  lhs,
const InternalCF *const  rhs 
)
inline

Definition at line 347 of file imm.h.

348 {
349  return int2imm_gf( gf_mul( imm2int( lhs ), imm2int( rhs ) ) );
350 }
InternalCF * int2imm_gf(long i)
Definition: imm.h:102
int gf_mul(int a, int b)
Definition: gfops.h:163
long imm2int(const InternalCF *const imm)
Definition: imm.h:66

§ imm_mul_p()

InternalCF* imm_mul_p ( const InternalCF *const  lhs,
const InternalCF *const  rhs 
)
inline

Definition at line 342 of file imm.h.

343 {
344  return int2imm_p( ff_mul( imm2int( lhs ), imm2int( rhs ) ) );
345 }
int ff_mul(const int a, const int b)
Definition: ffops.h:141
InternalCF * int2imm_p(long i)
Definition: imm.h:97
long imm2int(const InternalCF *const imm)
Definition: imm.h:66

§ imm_neg()

InternalCF* imm_neg ( const InternalCF *const  op)
inline

Definition at line 451 of file imm.h.

452 {
453  return int2imm( -imm2int( op ) );
454 }
InternalCF * int2imm(long i)
Definition: imm.h:71
long imm2int(const InternalCF *const imm)
Definition: imm.h:66

§ imm_neg_gf()

InternalCF* imm_neg_gf ( const InternalCF *const  op)
inline

Definition at line 463 of file imm.h.

464 {
465  return int2imm_gf( gf_neg( imm2int( op ) ) );
466 }
int gf_neg(int a)
Definition: gfops.h:123
InternalCF * int2imm_gf(long i)
Definition: imm.h:102
long imm2int(const InternalCF *const imm)
Definition: imm.h:66

§ imm_neg_p()

InternalCF* imm_neg_p ( const InternalCF *const  op)
inline

Definition at line 457 of file imm.h.

458 {
459  return int2imm_p( ff_neg( imm2int( op ) ) );
460 }
InternalCF * int2imm_p(long i)
Definition: imm.h:97
int ff_neg(const int a)
Definition: ffops.h:128
long imm2int(const InternalCF *const imm)
Definition: imm.h:66

§ imm_print()

void imm_print ( OSTREAM os,
const InternalCF *const  op,
const char *const  str 
)
inline

Definition at line 472 of file imm.h.

473 {
474  if ( is_imm( op ) == FFMARK )
475  if ( cf_glob_switches.isOn( SW_SYMMETRIC_FF ) )
476  os << ff_symmetric( imm2int( op ) ) << str;
477  else
478  os << imm2int( op ) << str;
479  else if ( is_imm( op ) == GFMARK ) {
480  gf_print( os, imm2int( op ) );
481  os << str;
482  }
483  else
484  os << imm2int( op ) << str;
485 }
const long GFMARK
Definition: imm.h:39
void gf_print(OSTREAM &os, int a)
Definition: gfops.h:207
const long FFMARK
Definition: imm.h:38
long imm2int(const InternalCF *const imm)
Definition: imm.h:66
int is_imm(const InternalCF *const ptr)
Definition: canonicalform.h:60
#define cf_glob_switches
CFSwitches cf_glob_switches;.
Definition: cf_switches.h:75
static const int SW_SYMMETRIC_FF
set to 1 for symmetric representation over F_q
Definition: cf_defs.h:30
int ff_symmetric(const int a)
Definition: ffops.h:59

§ imm_sign()

int imm_sign ( const InternalCF *const  op)
inline

imm_sign() - return sign of immediate object.

If CO is an immediate integer, the sign is defined as usual. If CO is an element of FF(p) and SW_SYMMETRIC_FF is on the sign of CO is the sign of the symmetric representation of CO. If CO is in GF(q) or in FF(p) and SW_SYMMETRIC_FF is off, the sign of CO is zero iff CO is zero, otherwise the sign is one.

See also
CanonicalForm::sign(), gf_sign()

Definition at line 193 of file imm.h.

194 {
195  if ( is_imm( op ) == FFMARK )
196  if ( imm2int( op ) == 0 )
197  return 0;
198  else if ( cf_glob_switches.isOn( SW_SYMMETRIC_FF ) )
199  if ( ff_symmetric( imm2int( op ) ) > 0 )
200  return 1;
201  else
202  return -1;
203  else
204  return 1;
205  else if ( is_imm( op ) == GFMARK )
206  return gf_sign( imm2int( op ) );
207  else if ( imm2int( op ) == 0 )
208  return 0;
209  else if ( imm2int( op ) > 0 )
210  return 1;
211  else
212  return -1;
213 }
const long GFMARK
Definition: imm.h:39
const long FFMARK
Definition: imm.h:38
long imm2int(const InternalCF *const imm)
Definition: imm.h:66
int gf_sign(int a)
Definition: gfops.h:113
int is_imm(const InternalCF *const ptr)
Definition: canonicalform.h:60
#define cf_glob_switches
CFSwitches cf_glob_switches;.
Definition: cf_switches.h:75
static const int SW_SYMMETRIC_FF
set to 1 for symmetric representation over F_q
Definition: cf_defs.h:30
int ff_symmetric(const int a)
Definition: ffops.h:59

§ imm_sub()

InternalCF* imm_sub ( const InternalCF *const  lhs,
const InternalCF *const  rhs 
)
inline

Definition at line 284 of file imm.h.

285 {
286  long result = imm2int( lhs ) - imm2int( rhs );
287  if ( ( result > MAXIMMEDIATE ) || ( result < MINIMMEDIATE ) )
288  return CFFactory::basic( result );
289  else
290  return int2imm( result );
291 }
const long MINIMMEDIATE
Definition: imm.h:50
InternalCF * int2imm(long i)
Definition: imm.h:71
static InternalCF * basic(long value)
Definition: cf_factory.cc:28
long imm2int(const InternalCF *const imm)
Definition: imm.h:66
const long MAXIMMEDIATE
Definition: imm.h:51
return result
Definition: facAbsBiFact.cc:76

§ imm_sub_gf()

InternalCF* imm_sub_gf ( const InternalCF *const  lhs,
const InternalCF *const  rhs 
)
inline

Definition at line 298 of file imm.h.

299 {
300  return int2imm_gf( gf_sub( imm2int( lhs ), imm2int( rhs ) ) );
301 }
int gf_sub(int a, int b)
Definition: gfops.h:158
InternalCF * int2imm_gf(long i)
Definition: imm.h:102
long imm2int(const InternalCF *const imm)
Definition: imm.h:66

§ imm_sub_p()

InternalCF* imm_sub_p ( const InternalCF *const  lhs,
const InternalCF *const  rhs 
)
inline

Definition at line 293 of file imm.h.

294 {
295  return int2imm_p( ff_sub( imm2int( lhs ), imm2int( rhs ) ) );
296 }
InternalCF * int2imm_p(long i)
Definition: imm.h:97
int ff_sub(const int a, const int b)
Definition: ffops.h:114
long imm2int(const InternalCF *const imm)
Definition: imm.h:66

§ int2imm()

InternalCF* int2imm ( long  i)
inline

Definition at line 71 of file imm.h.

72 {
73  return (InternalCF*)((i << 2) | INTMARK );
74 }
virtual class for internal CanonicalForm&#39;s
Definition: int_cf.h:39
int i
Definition: cfEzgcd.cc:123
const long INTMARK
Definition: imm.h:37

§ int2imm_gf()

InternalCF* int2imm_gf ( long  i)
inline

Definition at line 102 of file imm.h.

103 {
104  return (InternalCF*)((i << 2) | GFMARK );
105 }
const long GFMARK
Definition: imm.h:39
virtual class for internal CanonicalForm&#39;s
Definition: int_cf.h:39
int i
Definition: cfEzgcd.cc:123

§ int2imm_p()

InternalCF* int2imm_p ( long  i)
inline

Definition at line 97 of file imm.h.

98 {
99  return (InternalCF*)((i << 2) | FFMARK );
100 }
const long FFMARK
Definition: imm.h:38
virtual class for internal CanonicalForm&#39;s
Definition: int_cf.h:39
int i
Definition: cfEzgcd.cc:123

Variable Documentation

§ FFMARK

const long FFMARK = 2

Definition at line 38 of file imm.h.

§ GFMARK

const long GFMARK = 3

Definition at line 39 of file imm.h.

§ INTMARK

const long INTMARK = 1

Definition at line 37 of file imm.h.

§ MAXIMMEDIATE

const long MAXIMMEDIATE = (1L<<60)-2L

Definition at line 51 of file imm.h.

§ MAXIMMEDIATELL

const FACTORY_INT64 MAXIMMEDIATELL = 268435454LL

Definition at line 59 of file imm.h.

§ MINIMMEDIATE

const long MINIMMEDIATE = -(1L<<60)+2L

Definition at line 50 of file imm.h.

§ MINIMMEDIATELL

const FACTORY_INT64 MINIMMEDIATELL = -268435454LL

Definition at line 58 of file imm.h.