Regina 7.3 Calculation Engine
Public Types | Public Member Functions | List of all members
regina::NativeInteger< bytes > Class Template Reference

A wrapper class for a native, fixed-precision integer type of the given size. More...

#include <maths/integer.h>

Public Types

using Native = typename IntOfSize< bytes >::type
 The native data type used to store this integer. More...
 

Public Member Functions

 NativeInteger ()
 Initialises this integer to zero. More...
 
 NativeInteger (Native value)
 Initialises this integer to the given value. More...
 
 NativeInteger (const NativeInteger< bytes > &value)
 Initialises this integer to the given value. More...
 
template<bool supportInfinity>
 NativeInteger (const IntegerBase< supportInfinity > &value)
 Initialises this integer to the given value. More...
 
bool isZero () const
 Returns whether or not this integer is zero. More...
 
int sign () const
 Returns the sign of this integer. More...
 
Native nativeValue () const
 Returns the value of this integer in its native type. More...
 
NativeIntegeroperator= (const NativeInteger &value)
 Sets this integer to the given value. More...
 
NativeIntegeroperator= (Native value)
 Sets this integer to the given value. More...
 
void swap (NativeInteger &other) noexcept
 Swaps the values of this and the given integer. More...
 
bool operator== (const NativeInteger &rhs) const
 Determines if this is equal to the given integer. More...
 
bool operator== (Native rhs) const
 Determines if this is equal to the given integer. More...
 
bool operator!= (const NativeInteger &rhs) const
 Determines if this is not equal to the given integer. More...
 
bool operator!= (Native rhs) const
 Determines if this is not equal to the given integer. More...
 
bool operator< (const NativeInteger &rhs) const
 Determines if this is less than the given integer. More...
 
bool operator< (Native rhs) const
 Determines if this is less than the given integer. More...
 
bool operator> (const NativeInteger &rhs) const
 Determines if this is greater than the given integer. More...
 
bool operator> (Native rhs) const
 Determines if this is greater than the given integer. More...
 
bool operator<= (const NativeInteger &rhs) const
 Determines if this is less than or equal to the given integer. More...
 
bool operator<= (Native rhs) const
 Determines if this is less than or equal to the given integer. More...
 
bool operator>= (const NativeInteger &rhs) const
 Determines if this is greater than or equal to the given integer. More...
 
bool operator>= (Native rhs) const
 Determines if this is greater than or equal to the given integer. More...
 
NativeIntegeroperator++ ()
 The preincrement operator. More...
 
NativeInteger operator++ (int)
 The postincrement operator. More...
 
NativeIntegeroperator-- ()
 The predecrement operator. More...
 
NativeInteger operator-- (int)
 The postdecrement operator. More...
 
NativeInteger operator+ (const NativeInteger &other) const
 Adds this to the given integer and returns the result. More...
 
NativeInteger operator+ (Native other) const
 Adds this to the given integer and returns the result. More...
 
NativeInteger operator- (const NativeInteger &other) const
 Subtracts the given integer from this and returns the result. More...
 
NativeInteger operator- (Native other) const
 Subtracts the given integer from this and returns the result. More...
 
NativeInteger operator* (const NativeInteger &other) const
 Multiplies this by the given integer and returns the result. More...
 
NativeInteger operator* (Native other) const
 Multiplies this by the given integer and returns the result. More...
 
NativeInteger operator/ (const NativeInteger &other) const
 Divides this by the given integer and returns the result. More...
 
NativeInteger operator/ (Native other) const
 Divides this by the given integer and returns the result. More...
 
NativeInteger divExact (const NativeInteger &other) const
 Divides this by the given integer and returns the result. More...
 
NativeInteger divExact (Native other) const
 Divides this by the given integer and returns the result. More...
 
NativeInteger operator% (const NativeInteger &other) const
 Determines the remainder when this integer is divided by the given integer. More...
 
NativeInteger operator% (Native other) const
 Determines the remainder when this integer is divided by the given integer. More...
 
std::pair< NativeInteger, NativeIntegerdivisionAlg (const NativeInteger &divisor) const
 Uses the division algorithm to obtain a quotient and remainder when dividing by the given integer. More...
 
NativeInteger operator- () const
 Determines the negative of this integer. More...
 
NativeIntegeroperator+= (const NativeInteger &other)
 Adds the given integer to this. More...
 
NativeIntegeroperator+= (Native other)
 Adds the given integer to this. More...
 
NativeIntegeroperator-= (const NativeInteger &other)
 Subtracts the given integer from this. More...
 
NativeIntegeroperator-= (Native other)
 Subtracts the given integer from this. More...
 
NativeIntegeroperator*= (const NativeInteger &other)
 Multiplies the given integer by this. More...
 
NativeIntegeroperator*= (Native other)
 Multiplies the given integer by this. More...
 
NativeIntegeroperator/= (const NativeInteger &other)
 Divides this by the given integer. More...
 
NativeIntegeroperator/= (Native other)
 Divides this by the given integer. More...
 
NativeIntegerdivByExact (const NativeInteger &other)
 Divides this by the given integer. More...
 
NativeIntegerdivByExact (Native other)
 Divides this by the given integer. More...
 
NativeIntegeroperator%= (const NativeInteger &other)
 Reduces this integer modulo the given integer. More...
 
NativeIntegeroperator%= (Native other)
 Reduces this integer modulo the given integer. More...
 
void negate ()
 Negates this integer. More...
 
void gcdWith (const NativeInteger &other)
 Sets this integer to be the greatest common divisor of this and the given integer. More...
 
NativeInteger gcd (const NativeInteger &other) const
 Determines the greatest common divisor of this and the given integer. More...
 
bool isInfinite () const
 Returns whether this integer is infinity. More...
 
void tryReduce ()
 A do-nothing routine that ensures that this integer is using a native C/C++ integer representation. More...
 

Detailed Description

template<int bytes>
class regina::NativeInteger< bytes >

A wrapper class for a native, fixed-precision integer type of the given size.

This class behaves just like native integer arithmetic, where the underlying integer type is signed and stores the given number of bytes. There is no overflow testing, and it is up to the user to ensure that overflows do not occur. On the other hand, this class is almost as fast as native integer arithmetic (i.e., there is very little overhead).

The reason for using this class, instead of working directly in a native integer type, is that this class offers an interface that is compatible with Integer. Only some of the Integer member functions are offered here; however, those that are offered behave just like their Integer counterparts (with the single exception that all arithmetic in NativeInteger is subject to overflow). Developers can therefore switch between integer types easily with minimal changes to their code, or support both Integer and NativeInteger types as template arguments.

This class supports copying but does not implement separate move operations, since its internal data is so small that copying is just as efficient. It implements the C++ Swappable requirement via its own member and global swap() functions, for consistency with the Integer and LargeInteger classes.

Precondition
The system must support integers of the given size; in particular, there must be an appropriate specialisation IntOfSize<bytes>.
Python
Not present. The purpose of NativeInteger is to be a highly optimised drop-in replacement for Integer as a C++ template parameter. Python users should just use regina.Integer if you need Regina's integer interface, or Python's own integer type if you do not.

Member Typedef Documentation

◆ Native

template<int bytes>
using regina::NativeInteger< bytes >::Native = typename IntOfSize<bytes>::type

The native data type used to store this integer.

Constructor & Destructor Documentation

◆ NativeInteger() [1/4]

template<int bytes>
regina::NativeInteger< bytes >::NativeInteger
inline

Initialises this integer to zero.

◆ NativeInteger() [2/4]

template<int bytes>
regina::NativeInteger< bytes >::NativeInteger ( Native  value)
inline

Initialises this integer to the given value.

Parameters
valuethe new value of this integer.

◆ NativeInteger() [3/4]

template<int bytes>
regina::NativeInteger< bytes >::NativeInteger ( const NativeInteger< bytes > &  value)
inline

Initialises this integer to the given value.

Parameters
valuethe new value of this integer.

◆ NativeInteger() [4/4]

template<int bytes>
template<bool supportInfinity>
regina::NativeInteger< bytes >::NativeInteger ( const IntegerBase< supportInfinity > &  value)
inlineexplicit

Initialises this integer to the given value.

This constructor is marked as explicit in the hope of avoiding accidental (and unintentional) mixing of integer classes.

It is the programmer's reponsibility to ensure that the given value fits within the required range. If the given value is too large or small to fit into this native type, then this new NativeInteger will have an undefined initial value.

Precondition
If bytes is larger than sizeof(long), then bytes is a strict multiple of sizeof(long). For instance, if longs are 8 bytes then you can use this routine with bytes=16 but not bytes=12. This restriction is enforced through a compile-time assertion, but may be lifted in future versions of Regina.
The given integer is not infinity.
Parameters
valuethe new value of this integer.

Member Function Documentation

◆ divByExact() [1/2]

template<int bytes>
NativeInteger< bytes > & regina::NativeInteger< bytes >::divByExact ( const NativeInteger< bytes > &  other)
inline

Divides this by the given integer.

For native integers, this routine is identical to operator /=.

Precondition
other is not zero.
Parameters
otherthe integer to divide this by.
Returns
a reference to this integer with its new value.

◆ divByExact() [2/2]

template<int bytes>
NativeInteger< bytes > & regina::NativeInteger< bytes >::divByExact ( Native  other)
inline

Divides this by the given integer.

For native integers, this routine is identical to operator /=.

Precondition
other is not zero.
Parameters
otherthe integer to divide this by.
Returns
a reference to this integer with its new value.

◆ divExact() [1/2]

template<int bytes>
NativeInteger< bytes > regina::NativeInteger< bytes >::divExact ( const NativeInteger< bytes > &  other) const
inline

Divides this by the given integer and returns the result.

For native integers, this is identical to operator /.

Precondition
other is not zero.
Parameters
otherthe integer to divide this by.
Returns
the quotient this divided by other.

◆ divExact() [2/2]

template<int bytes>
NativeInteger< bytes > regina::NativeInteger< bytes >::divExact ( Native  other) const
inline

Divides this by the given integer and returns the result.

For native integers, this is identical to operator /.

Precondition
other is not zero.
Parameters
otherthe integer to divide this by.
Returns
the quotient this divided by other.

◆ divisionAlg()

template<int bytes>
std::pair< NativeInteger< bytes >, NativeInteger< bytes > > regina::NativeInteger< bytes >::divisionAlg ( const NativeInteger< bytes > &  divisor) const
inline

Uses the division algorithm to obtain a quotient and remainder when dividing by the given integer.

Suppose this integer is n and we pass the divisor d. The division algorithm describes the result of dividing n by d; in particular, it expresses n = qd + r, where q is the quotient and r is the remainder.

The division algorithm is precise about which values of q and r are chosen; in particular it chooses the unique r in the range 0 ≤ r < |d|.

Note that this differs from other division routines in this class, in that it always rounds to give a non-negative remainder. Thus (-7).divisionAlg(3) gives quotient -3 and remainder 2, whereas (-7)/3 gives quotient -2 and (-7)%3 gives remainder -1.

In the special case where the given divisor is 0 (not allowed by the usual division algorithm), this routine selects quotient 0 and remainder n.

Parameters
divisorthe divisor d.
Returns
the pair (q, r), where q is the quotient and r is the remainder, as described above.

◆ gcd()

template<int bytes>
NativeInteger< bytes > regina::NativeInteger< bytes >::gcd ( const NativeInteger< bytes > &  other) const
inline

Determines the greatest common divisor of this and the given integer.

This integer is not changed.

The result is guaranteed to be non-negative. As a special case, gcd(0,0) is considered to be zero.

Parameters
otherthe integer whose greatest common divisor with this will be found.
Returns
the greatest common divisor of this and the given integer.

◆ gcdWith()

template<int bytes>
void regina::NativeInteger< bytes >::gcdWith ( const NativeInteger< bytes > &  other)

Sets this integer to be the greatest common divisor of this and the given integer.

The result is guaranteed to be non-negative. As a special case, gcd(0,0) is considered to be zero.

Parameters
otherthe integer whose greatest common divisor with this will be found.

Now everything is non-negative. The following code is based on Stein's binary GCD algorithm.

◆ isInfinite()

template<int bytes>
bool regina::NativeInteger< bytes >::isInfinite
inline

Returns whether this integer is infinity.

Since NativeInteger cannot represent infinity, this routine will always return false. This routine is simply provided for compatibility with LargeInteger (where infinity is allowed).

Returns
false, since a NativeInteger can never be infinity.

◆ isZero()

template<int bytes>
bool regina::NativeInteger< bytes >::isZero
inline

Returns whether or not this integer is zero.

Returns
true if and only if this integer is zero.

◆ nativeValue()

template<int bytes>
NativeInteger< bytes >::Native regina::NativeInteger< bytes >::nativeValue
inline

Returns the value of this integer in its native type.

Returns
the value of this integer.

◆ negate()

template<int bytes>
void regina::NativeInteger< bytes >::negate
inline

Negates this integer.

This integer is changed to reflect the result.

◆ operator!=() [1/2]

template<int bytes>
bool regina::NativeInteger< bytes >::operator!= ( const NativeInteger< bytes > &  rhs) const
inline

Determines if this is not equal to the given integer.

Parameters
rhsthe integer with which this will be compared.
Returns
true if and only if this and the given integer are not equal.

◆ operator!=() [2/2]

template<int bytes>
bool regina::NativeInteger< bytes >::operator!= ( Native  rhs) const
inline

Determines if this is not equal to the given integer.

Parameters
rhsthe integer with which this will be compared.
Returns
true if and only if this and the given integer are not equal.

◆ operator%() [1/2]

template<int bytes>
NativeInteger< bytes > regina::NativeInteger< bytes >::operator% ( const NativeInteger< bytes > &  other) const
inline

Determines the remainder when this integer is divided by the given integer.

If non-zero, the result will have the same sign as this integer. This integer is not changed.

For a division routine that always returns a non-negative remainder, see divisionAlg().

Precondition
other is not zero.
Parameters
otherthe integer to divide this by.
Returns
the remainder this modulo other.

◆ operator%() [2/2]

template<int bytes>
NativeInteger< bytes > regina::NativeInteger< bytes >::operator% ( Native  other) const
inline

Determines the remainder when this integer is divided by the given integer.

If non-zero, the result will have the same sign as this integer. This integer is not changed.

For a division routine that always returns a non-negative remainder, see divisionAlg().

Precondition
other is not zero.
Parameters
otherthe integer to divide this by.
Returns
the remainder this modulo other.

◆ operator%=() [1/2]

template<int bytes>
NativeInteger< bytes > & regina::NativeInteger< bytes >::operator%= ( const NativeInteger< bytes > &  other)
inline

Reduces this integer modulo the given integer.

If non-zero, the result will have the same sign as the original value of this integer. This integer is changed to reflect the result.

For a mod routine that always returns a non-negative remainder, see divisionAlg().

Precondition
other is not zero.
Parameters
otherthe integer modulo which this integer will be reduced.
Returns
a reference to this integer with its new value.

◆ operator%=() [2/2]

template<int bytes>
NativeInteger< bytes > & regina::NativeInteger< bytes >::operator%= ( Native  other)
inline

Reduces this integer modulo the given integer.

If non-zero, the result will have the same sign as the original value of this integer. This integer is changed to reflect the result.

For a mod routine that always returns a non-negative remainder, see divisionAlg().

Precondition
other is not zero.
Parameters
otherthe integer modulo which this integer will be reduced.
Returns
a reference to this integer with its new value.

◆ operator*() [1/2]

template<int bytes>
NativeInteger< bytes > regina::NativeInteger< bytes >::operator* ( const NativeInteger< bytes > &  other) const
inline

Multiplies this by the given integer and returns the result.

This integer is not changed.

Parameters
otherthe integer to multiply by this integer.
Returns
the product this times other.

◆ operator*() [2/2]

template<int bytes>
NativeInteger< bytes > regina::NativeInteger< bytes >::operator* ( Native  other) const
inline

Multiplies this by the given integer and returns the result.

This integer is not changed.

Parameters
otherthe integer to multiply by this integer.
Returns
the product this times other.

◆ operator*=() [1/2]

template<int bytes>
NativeInteger< bytes > & regina::NativeInteger< bytes >::operator*= ( const NativeInteger< bytes > &  other)
inline

Multiplies the given integer by this.

This integer is changed to reflect the result.

Parameters
otherthe integer to multiply with this integer.
Returns
a reference to this integer with its new value.

◆ operator*=() [2/2]

template<int bytes>
NativeInteger< bytes > & regina::NativeInteger< bytes >::operator*= ( Native  other)
inline

Multiplies the given integer by this.

This integer is changed to reflect the result.

Parameters
otherthe integer to multiply with this integer.
Returns
a reference to this integer with its new value.

◆ operator+() [1/2]

template<int bytes>
NativeInteger< bytes > regina::NativeInteger< bytes >::operator+ ( const NativeInteger< bytes > &  other) const
inline

Adds this to the given integer and returns the result.

This integer is not changed.

Parameters
otherthe integer to add to this integer.
Returns
the sum this plus other.

◆ operator+() [2/2]

template<int bytes>
NativeInteger< bytes > regina::NativeInteger< bytes >::operator+ ( Native  other) const
inline

Adds this to the given integer and returns the result.

This integer is not changed.

Parameters
otherthe integer to add to this integer.
Returns
the sum this plus other.

◆ operator++() [1/2]

template<int bytes>
NativeInteger< bytes > & regina::NativeInteger< bytes >::operator++
inline

The preincrement operator.

This operator increments this integer by one, and returns a reference to the integer after the increment.

Returns
a reference to this integer after the increment.

◆ operator++() [2/2]

template<int bytes>
NativeInteger< bytes > regina::NativeInteger< bytes >::operator++ ( int  )
inline

The postincrement operator.

This operator increments this integer by one, and returns a copy of the integer before the increment.

Returns
a copy of this integer before the increment took place.

◆ operator+=() [1/2]

template<int bytes>
NativeInteger< bytes > & regina::NativeInteger< bytes >::operator+= ( const NativeInteger< bytes > &  other)
inline

Adds the given integer to this.

This integer is changed to reflect the result.

Parameters
otherthe integer to add to this integer.
Returns
a reference to this integer with its new value.

◆ operator+=() [2/2]

template<int bytes>
NativeInteger< bytes > & regina::NativeInteger< bytes >::operator+= ( Native  other)
inline

Adds the given integer to this.

This integer is changed to reflect the result.

Parameters
otherthe integer to add to this integer.
Returns
a reference to this integer with its new value.

◆ operator-() [1/3]

template<int bytes>
NativeInteger< bytes > regina::NativeInteger< bytes >::operator-
inline

Determines the negative of this integer.

This integer is not changed.

Returns
the negative of this integer.

◆ operator-() [2/3]

template<int bytes>
NativeInteger< bytes > regina::NativeInteger< bytes >::operator- ( const NativeInteger< bytes > &  other) const
inline

Subtracts the given integer from this and returns the result.

This integer is not changed.

Parameters
otherthe integer to subtract from this integer.
Returns
the difference this minus other.

◆ operator-() [3/3]

template<int bytes>
NativeInteger< bytes > regina::NativeInteger< bytes >::operator- ( Native  other) const
inline

Subtracts the given integer from this and returns the result.

This integer is not changed.

Parameters
otherthe integer to subtract from this integer.
Returns
the difference this minus other.

◆ operator--() [1/2]

template<int bytes>
NativeInteger< bytes > & regina::NativeInteger< bytes >::operator--
inline

The predecrement operator.

This operator decrements this integer by one, and returns a reference to the integer after the decrement.

Returns
a reference to this integer after the decrement.

◆ operator--() [2/2]

template<int bytes>
NativeInteger< bytes > regina::NativeInteger< bytes >::operator-- ( int  )
inline

The postdecrement operator.

This operator decrements this integer by one, and returns a copy of the integer before the decrement.

Returns
a copy of this integer before the decrement took place.

◆ operator-=() [1/2]

template<int bytes>
NativeInteger< bytes > & regina::NativeInteger< bytes >::operator-= ( const NativeInteger< bytes > &  other)
inline

Subtracts the given integer from this.

This integer is changed to reflect the result.

Parameters
otherthe integer to subtract from this integer.
Returns
a reference to this integer with its new value.

◆ operator-=() [2/2]

template<int bytes>
NativeInteger< bytes > & regina::NativeInteger< bytes >::operator-= ( Native  other)
inline

Subtracts the given integer from this.

This integer is changed to reflect the result.

Parameters
otherthe integer to subtract from this integer.
Returns
a reference to this integer with its new value.

◆ operator/() [1/2]

template<int bytes>
NativeInteger< bytes > regina::NativeInteger< bytes >::operator/ ( const NativeInteger< bytes > &  other) const
inline

Divides this by the given integer and returns the result.

The result will be truncated to an integer, i.e. rounded towards zero. This integer is not changed.

For a division routine that always rounds down, see divisionAlg().

Precondition
other must be non-zero.
Parameters
otherthe integer to divide this by.
Returns
the quotient this divided by other.

◆ operator/() [2/2]

template<int bytes>
NativeInteger< bytes > regina::NativeInteger< bytes >::operator/ ( Native  other) const
inline

Divides this by the given integer and returns the result.

The result will be truncated to an integer, i.e. rounded towards zero. This integer is not changed.

For a division routine that always rounds down, see divisionAlg().

Precondition
other must be non-zero.
Parameters
otherthe integer to divide this by.
Returns
the quotient this divided by other.

◆ operator/=() [1/2]

template<int bytes>
NativeInteger< bytes > & regina::NativeInteger< bytes >::operator/= ( const NativeInteger< bytes > &  other)
inline

Divides this by the given integer.

The result will be truncated to an integer, i.e. rounded towards zero. This integer is changed to reflect the result.

For a division routine that always rounds down, see divisionAlg().

Precondition
other must be non-zero.
Parameters
otherthe integer to divide this by.
Returns
a reference to this integer with its new value.

◆ operator/=() [2/2]

template<int bytes>
NativeInteger< bytes > & regina::NativeInteger< bytes >::operator/= ( Native  other)
inline

Divides this by the given integer.

The result will be truncated to an integer, i.e. rounded towards zero. This integer is changed to reflect the result.

For a division routine that always rounds down, see divisionAlg().

Precondition
other must be non-zero.
Parameters
otherthe integer to divide this by.
Returns
a reference to this integer with its new value.

◆ operator<() [1/2]

template<int bytes>
bool regina::NativeInteger< bytes >::operator< ( const NativeInteger< bytes > &  rhs) const
inline

Determines if this is less than the given integer.

Parameters
rhsthe integer with which this will be compared.
Returns
true if and only if this is less than the given integer.

◆ operator<() [2/2]

template<int bytes>
bool regina::NativeInteger< bytes >::operator< ( Native  rhs) const
inline

Determines if this is less than the given integer.

Parameters
rhsthe integer with which this will be compared.
Returns
true if and only if this is less than the given integer.

◆ operator<=() [1/2]

template<int bytes>
bool regina::NativeInteger< bytes >::operator<= ( const NativeInteger< bytes > &  rhs) const
inline

Determines if this is less than or equal to the given integer.

Parameters
rhsthe integer with which this will be compared.
Returns
true if and only if this is less than or equal to the given integer.

◆ operator<=() [2/2]

template<int bytes>
bool regina::NativeInteger< bytes >::operator<= ( Native  rhs) const
inline

Determines if this is less than or equal to the given integer.

Parameters
rhsthe integer with which this will be compared.
Returns
true if and only if this is less than or equal to the given integer.

◆ operator=() [1/2]

template<int bytes>
NativeInteger< bytes > & regina::NativeInteger< bytes >::operator= ( const NativeInteger< bytes > &  value)
inline

Sets this integer to the given value.

Parameters
valuethe new value of this integer.
Returns
a reference to this integer with its new value.

◆ operator=() [2/2]

template<int bytes>
NativeInteger< bytes > & regina::NativeInteger< bytes >::operator= ( Native  value)
inline

Sets this integer to the given value.

Parameters
valuethe new value of this integer.
Returns
a reference to this integer with its new value.

◆ operator==() [1/2]

template<int bytes>
bool regina::NativeInteger< bytes >::operator== ( const NativeInteger< bytes > &  rhs) const
inline

Determines if this is equal to the given integer.

Parameters
rhsthe integer with which this will be compared.
Returns
true if and only if this and the given integer are equal.

◆ operator==() [2/2]

template<int bytes>
bool regina::NativeInteger< bytes >::operator== ( Native  rhs) const
inline

Determines if this is equal to the given integer.

Parameters
rhsthe integer with which this will be compared.
Returns
true if and only if this and the given integer are equal.

◆ operator>() [1/2]

template<int bytes>
bool regina::NativeInteger< bytes >::operator> ( const NativeInteger< bytes > &  rhs) const
inline

Determines if this is greater than the given integer.

Parameters
rhsthe integer with which this will be compared.
Returns
true if and only if this is greater than the given integer.

◆ operator>() [2/2]

template<int bytes>
bool regina::NativeInteger< bytes >::operator> ( Native  rhs) const
inline

Determines if this is greater than the given integer.

Parameters
rhsthe integer with which this will be compared.
Returns
true if and only if this is greater than the given integer.

◆ operator>=() [1/2]

template<int bytes>
bool regina::NativeInteger< bytes >::operator>= ( const NativeInteger< bytes > &  rhs) const
inline

Determines if this is greater than or equal to the given integer.

Parameters
rhsthe integer with which this will be compared.
Returns
true if and only if this is greater than or equal to the given integer.

◆ operator>=() [2/2]

template<int bytes>
bool regina::NativeInteger< bytes >::operator>= ( Native  rhs) const
inline

Determines if this is greater than or equal to the given integer.

Parameters
rhsthe integer with which this will be compared.
Returns
true if and only if this is greater than or equal to the given integer.

◆ sign()

template<int bytes>
int regina::NativeInteger< bytes >::sign
inline

Returns the sign of this integer.

Returns
+1, -1 or 0 according to whether this integer is positive, negative or zero.

◆ swap()

template<int bytes>
void regina::NativeInteger< bytes >::swap ( NativeInteger< bytes > &  other)
inlinenoexcept

Swaps the values of this and the given integer.

Parameters
otherthe integer whose value will be swapped with this.

◆ tryReduce()

template<int bytes>
void regina::NativeInteger< bytes >::tryReduce
inline

A do-nothing routine that ensures that this integer is using a native C/C++ integer representation.

Since the NativeInteger class always uses a native representation, this routine does nothing at all. This routine is simply provided for compatibility with Regina's arbitrary-precision Integer and LargeInteger classes.


The documentation for this class was generated from the following file:

Copyright © 1999-2023, The Regina development team
This software is released under the GNU General Public License, with some additional permissions; see the source code for details.
For further information, or to submit a bug or other problem, please contact Ben Burton (bab@maths.uq.edu.au).