parrotcode: Integer PMC class | |
Contents | PMCs |
src/pmc/integer.pmc - Integer PMC class
Integer
provides an integer for languages that want a value-restricted integer type without going to an I register.
PMC instantiate(PMC *sig)
void init()
0
.PMC new_from_string(STRING *rep)
rep
.void set_pmc(PMC *value)
*value
.void share()
INTVAL get_integer()
INTVAL get_bool()
FLOATVAL get_number()
PMC *get_bignum()
SELF
.STRING *get_string()
void set_integer_same(PMC *value)
void set_integer_native(INTVAL value)
Integer
*value
.void set_number_native(FLOATVAL value)
Float
and sets the value from value
.void set_bool(INTVAL value)
Boolean
and sets the value from value
.void set_bigint_int(INTVAL value)
BigInt
and sets the value from value
.void set_string_native(STRING *value)
String
and sets the value from value
.PMC *add(PMC *value, PMC *dest)
PMC *add_int(INTVAL value, PMC *dest)
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)
value
to SELF
inplace.PMC *subtract(PMC *value, PMC *dest)
*value
from the integer and returns the result in *dest
.
If dest
is NULL,
a new int PMC is created.SELF
or value
maybe be subclassed,
we have to call get_integer
and set_integer_native
always.PMC *subtract_int(INTVAL value, PMC *dest)
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)
value
from SELF
inplace.PMC *multiply(PMC *value, PMC *dest)
PMC *multiply_int(INTVAL value, PMC *dest)
*value
and returns the result in *dest
.void i_multiply(PMC *value)
void i_multiply_int(INTVAL value)
void i_multiply_float(FLOATVAL value)
value
with SELF
inplace.PMC *divide(PMC *value, PMC *dest)
PMC *divide_int(INTVAL value, PMC *dest)
PMC *divide_float(FLOATVAL value, PMC *dest)
value
and returns the result in *dest
.void i_divide(PMC *value)
void i_divide_int(INTVAL value)
void i_divide_float(FLOATVAL value)
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)
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)
SELF
by value
inplace.PMC *cmodulus(PMC *value, PMC *dest)
PMC *cmodulus(INTVAL value, PMC *dest)
PMC *cmodulus(FLOATVAL value, PMC *dest)
mod
value
and returns the result in dest
.void i_cmodulus(PMC *value)
void i_cmodulus(INTVAL value)
void i_cmodulus(FLOATVAL value)
mod
value
and returns the result in dest
.PMC *modulus(PMC *value, PMC *dest)
PMC *modulus(INTVAL value, PMC *dest)
PMC *modulus(FLOATVAL value, PMC *dest)
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)
PMC *pow(PMC *value, PMC *dest)
PMC *pow_int(INTVAL value, PMC *dest)
value
th power and return result in dest
.void i_pow(PMC *value)
void i_pow_int(INTVAL value)
value
th power.INTVAL is_equal (PMC *value)
==
operation.INTVAL cmp(PMC *value)
*value
.INTVAL cmp_num(PMC *value)
*value
.void increment()
void decrement()
PMC *absolute(PMC *dest)
void absolute()
dest
to the absolute value of SELF.STRING *get_as_base(INTVAL base)
base
.
base
must be between 2 and 36,
inclusize.void freeze(visit_info *info)
void thaw(visit_info *info)
|