NAME

src/pmc/integer.pmc - Integer PMC class

DESCRIPTION

Integer provides an integer for languages that want a value-restricted integer type without going to an I register.

Functions

PMC init_pmc(PMC *init)
Create a new Integer with arguments passed according to pdd03.
void init()
Initializes the integer with a default value of 0.
PMC *clone()
Creates an exact duplicate of this PMC.
void set_pmc(PMC *value)
Sets the value of the integer to the value in *value.
void share()
Sets this PMC as shared and read-only.
INTVAL get_integer()
Returns the integer value of the Integer.
INTVAL get_bool()
Returns the boolean value of the Integer.
FLOATVAL get_number()
Returns the floating-point value of the integer.
PMC *get_bignum()
Return a new BigInt PMC with the value of SELF.
STRING *get_string()
STRING *get_repr()
Returns the string value of the integer.
void set_integer_native(INTVAL value)
Sets the value of the integer to the value of the Integer *value.
void set_number_native(FLOATVAL value)
Morphs the integer to a Float and sets the value from value.
void set_bool(INTVAL value)
Morphs the integer to a Boolean and sets the value from value.
void set_bigint_int(INTVAL value)
Morphs the integer to a BigInt and sets the value from value.
void set_string_native(STRING *value)
Morphs the integer to a String and sets the value from value.
PMC *add(PMC *value, PMC *dest)
PMC *add_int(INTVAL value, PMC *dest)
Adds value to the integer and returns the result in *dest.
void i_add(PMC *value)
void i_add(INTVAL value)
void i_add(FLOATVAL value)
Adds value to SELF inplace.
PMC *subtract(PMC *value, PMC *dest)
Subtracts *value from the integer and returns the result in *dest. If dest is NULL, a PMC of this type.Please note: as SELF or value maybe be subclassed, we have to call get_integer and set_integer_native always.
PMC *subtract_int(INTVAL value, PMC *dest)
Subtracts value from the integer and returns the result in *dest.
void i_subtract(PMC *value)
void i_subtract_int(INTVAL value)
void i_subtract_float(FLOATVAL value)
Subtracts value from SELF inplace.
PMC *multiply(PMC *value, PMC *dest)
PMC *multiply_int(INTVAL value, PMC *dest)
Multiplies the integer by *value and returns the result in *dest.
void i_multiply(PMC *value)
void i_multiply_int(INTVAL value)
void i_multiply_float(FLOATVAL value)
Multiply value with SELF inplace.
PMC *divide(PMC *value, PMC *dest)
PMC *divide_int(INTVAL value, PMC *dest)
PMC *divide_float(FLOATVAL value, PMC *dest)
Divides the number by value and returns the result in *dest.
void i_divide(PMC *value)
void i_divide_int(INTVAL value)
void i_divide_float(FLOATVAL value)
Divides SELF by value inplace.
PMC *floor_divide(PMC *value, PMC *dest)
PMC *floor_divide_int(INTVAL value, PMC *dest)
PMC *floor_divide_float(FLOATVAL value, PMC *dest)
Divides the number by value and returns the result in *dest.
void i_floor_divide(PMC *value)
void i_floor_divide_int(INTVAL value)
void i_floor_divide_float(FLOATVAL value)
Divides SELF by value inplace.
PMC *modulus(PMC *value, PMC *dest)
PMC *modulus(INTVAL value, PMC *dest)
PMC *modulus(FLOATVAL value, PMC *dest)
Calculates the value of corrected mod value and returns the result in dest. See also ops/math.ops.
void i_modulus(PMC *value)
void i_modulus(INTVAL value)
void i_modulus(FLOATVAL value)
Calculates modulus in place.
PMC *pow(PMC *value, PMC *dest)
PMC *pow_int(INTVAL value, PMC *dest)
Returns SELF to the valueth power in dest.
void i_pow(PMC *value)
void i_pow_int(INTVAL value)
Raises SELF to the valueth power.TODO: TT #1228: Implement Complex and BigInt RHS values for the pow() functions
INTVAL is_equal(PMC *value)
The == operation.
INTVAL cmp(PMC *value)
Returns the result of comparing the integer with *value.
INTVAL cmp_num(PMC *value)
Returns the result of numerically comparing the integer with *value.
void increment()
Increments the integer.
void decrement()
Decrements the integer.
PMC *absolute(PMC *dest)
void absolute()
Sets dest to the absolute value of SELF.
STRING *get_as_base(INTVAL base)
Converts and returns the integer in base base. base must be between 2 and 36, inclusive.
void freeze(visit_info *info)
Used to archive the integer.
void thaw(visit_info *info)
Used to unarchive the integer.