Ignore:
Timestamp:
Aug 6, 2003, 10:18:36 PM (17 years ago)
Author:
orlov
Message:
  • Added methods for comparison with long int and conversion to it.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • to-imperative/trunk/runtime/rf_integer.ih

    r1082 r1117  
    8989}
    9090
     91inline bool Integer::operator == (intptr_t _n) const
     92{
     93  mpz_t* p = static_cast<mpz_t*>(ptr_data2);
     94  return mpz_cmp_si(*p, _n) == 0;
     95}
     96
    9197inline int Integer::cmp (Integer const& _n) const
    9298{
     
    94100  mpz_t* q = static_cast<mpz_t*>(_n.ptr_data2);
    95101  return mpz_cmp(*p, *q);
     102}
     103
     104inline int Integer::cmp (intptr_t _n) const
     105{
     106  mpz_t* p = static_cast<mpz_t*>(ptr_data2);
     107  return mpz_cmp_si(*p, _n);
    96108}
    97109
     
    272284}
    273285
     286inline long Integer::to_int () const
     287{
     288  return mpz_get_si(*(get_mpz_ptr()));
     289}
     290
    274291inline Integer::operator pxx::WString () const
    275292{
Note: See TracChangeset for help on using the changeset viewer.