Skip to content

module internal.types.int

Source: stdlib/internal/types/int.codon


int @extend Class is extended to add given methods

Properties

real @property Method is a class property

imag @property Method is a class property

Magic methods

__new__() @pure Function has no side effects and returns same value for same inputs @llvm Function is implemented with inline LLVM IR

ret i64 0

__new__(s: str, base: int) @overload Function is overloaded

__new__(what) @overload Function is overloaded

__int__(self)

__float__(self) @pure Function has no side effects and returns same value for same inputs @llvm Function is implemented with inline LLVM IR

%tmp = sitofp i64 %self to double
ret double %tmp

__index__(self)

__repr__(self)

__copy__(self)

__deepcopy__(self)

__hash__(self)

__bool__(self) @pure Function has no side effects and returns same value for same inputs @llvm Function is implemented with inline LLVM IR

%0 = icmp ne i64 %self, 0
%1 = zext i1 %0 to i8
ret i8 %1

__pos__(self)

__neg__(self)

__abs__(self) @pure Function has no side effects and returns same value for same inputs @llvm Function is implemented with inline LLVM IR

declare i64 @llvm.abs.i64(i64, i1)
%0 = call i64 @llvm.abs.i64(i64 %self, i1 false)
ret i64 %0

__lshift__(self, other: int) @pure Function has no side effects and returns same value for same inputs @llvm Function is implemented with inline LLVM IR

%0 = shl i64 %self, %other
ret i64 %0

__rshift__(self, other: int) @pure Function has no side effects and returns same value for same inputs @llvm Function is implemented with inline LLVM IR

%0 = ashr i64 %self, %other
ret i64 %0

__add__(self, b: bool) @pure Function has no side effects and returns same value for same inputs @commutative Binary operator is commutative @associative Binary operator is associative @llvm Function is implemented with inline LLVM IR

%0 = sext {=bool} %b to i64
%1 = add i64 %self, %0
ret i64 %1

__add__(self, other: float) @pure Function has no side effects and returns same value for same inputs @commutative Binary operator is commutative @overload Function is overloaded @llvm Function is implemented with inline LLVM IR

%0 = sitofp i64 %self to double
%1 = fadd double %0, %other
ret double %1

__add__(self, b: int) @pure Function has no side effects and returns same value for same inputs @commutative Binary operator is commutative @associative Binary operator is associative @overload Function is overloaded @llvm Function is implemented with inline LLVM IR

%tmp = add i64 %self, %b
ret i64 %tmp

__sub__(self, other: float) @pure Function has no side effects and returns same value for same inputs @llvm Function is implemented with inline LLVM IR

%0 = sitofp i64 %self to double
%1 = fsub double %0, %other
ret double %1

__sub__(self, b: int) @pure Function has no side effects and returns same value for same inputs @overload Function is overloaded @llvm Function is implemented with inline LLVM IR

%tmp = sub i64 %self, %b
ret i64 %tmp

__mul__(self, other: float) @pure Function has no side effects and returns same value for same inputs @commutative Binary operator is commutative @llvm Function is implemented with inline LLVM IR

%0 = sitofp i64 %self to double
%1 = fmul double %0, %other
ret double %1

__mul__(self, b: int) @pure Function has no side effects and returns same value for same inputs @commutative Binary operator is commutative @associative Binary operator is associative @distributive Binary operator is distributive @overload Function is overloaded @llvm Function is implemented with inline LLVM IR

%tmp = mul i64 %self, %b
ret i64 %tmp

__floordiv__(self, other: float) @pure Function has no side effects and returns same value for same inputs @llvm Function is implemented with inline LLVM IR

declare double @llvm.floor.f64(double)
%0 = sitofp i64 %self to double
%1 = fdiv double %0, %other
%2 = call double @llvm.floor.f64(double %1)
ret double %2

__floordiv__(self, b: int) @pure Function has no side effects and returns same value for same inputs @overload Function is overloaded @llvm Function is implemented with inline LLVM IR

%tmp = sdiv i64 %self, %b
ret i64 %tmp

__truediv__(self, other: float) @pure Function has no side effects and returns same value for same inputs @llvm Function is implemented with inline LLVM IR

%0 = sitofp i64 %self to double
%1 = fdiv double %0, %other
ret double %1

__truediv__(self, other: int) @pure Function has no side effects and returns same value for same inputs @overload Function is overloaded @llvm Function is implemented with inline LLVM IR

%0 = sitofp i64 %self to double
%1 = sitofp i64 %other to double
%2 = fdiv double %0, %1
ret double %2

__mod__(self, other: float) @pure Function has no side effects and returns same value for same inputs @llvm Function is implemented with inline LLVM IR

%0 = sitofp i64 %self to double
%1 = frem double %0, %other
ret double %1

__mod__(a: int, b: int) @pure Function has no side effects and returns same value for same inputs @overload Function is overloaded @llvm Function is implemented with inline LLVM IR

%tmp = srem i64 %a, %b
ret i64 %tmp

__divmod__(self, other: float)

__divmod__(self, other: int) @overload Function is overloaded

__invert__(a: int) @pure Function has no side effects and returns same value for same inputs @llvm Function is implemented with inline LLVM IR

%tmp = xor i64 %a, -1
ret i64 %tmp

__and__(a: int, b: int) @pure Function has no side effects and returns same value for same inputs @commutative Binary operator is commutative @associative Binary operator is associative @llvm Function is implemented with inline LLVM IR

%tmp = and i64 %a, %b
ret i64 %tmp

__or__(a: int, b: int) @pure Function has no side effects and returns same value for same inputs @commutative Binary operator is commutative @associative Binary operator is associative @llvm Function is implemented with inline LLVM IR

%tmp = or i64 %a, %b
ret i64 %tmp

__xor__(a: int, b: int) @pure Function has no side effects and returns same value for same inputs @commutative Binary operator is commutative @associative Binary operator is associative @llvm Function is implemented with inline LLVM IR

%tmp = xor i64 %a, %b
ret i64 %tmp

__bitreverse__(a: int) @pure Function has no side effects and returns same value for same inputs @llvm Function is implemented with inline LLVM IR

declare i64 @llvm.bitreverse.i64(i64 %a)
%tmp = call i64 @llvm.bitreverse.i64(i64 %a)
ret i64 %tmp

__bswap__(a: int) @pure Function has no side effects and returns same value for same inputs @llvm Function is implemented with inline LLVM IR

declare i64 @llvm.bswap.i64(i64 %a)
%tmp = call i64 @llvm.bswap.i64(i64 %a)
ret i64 %tmp

__ctpop__(a: int) @pure Function has no side effects and returns same value for same inputs @llvm Function is implemented with inline LLVM IR

declare i64 @llvm.ctpop.i64(i64 %a)
%tmp = call i64 @llvm.ctpop.i64(i64 %a)
ret i64 %tmp

__ctlz__(a: int) @pure Function has no side effects and returns same value for same inputs @llvm Function is implemented with inline LLVM IR

declare i64 @llvm.ctlz.i64(i64 %a, i1 %is_zero_undef)
%tmp = call i64 @llvm.ctlz.i64(i64 %a, i1 false)
ret i64 %tmp

__cttz__(a: int) @pure Function has no side effects and returns same value for same inputs @llvm Function is implemented with inline LLVM IR

declare i64 @llvm.cttz.i64(i64 %a, i1 %is_zero_undef)
%tmp = call i64 @llvm.cttz.i64(i64 %a, i1 false)
ret i64 %tmp

__eq__(self, b: float) @pure Function has no side effects and returns same value for same inputs @llvm Function is implemented with inline LLVM IR

%0 = sitofp i64 %self to double
%1 = fcmp oeq double %0, %b
%2 = zext i1 %1 to i8
ret i8 %2

__eq__(a: int, b: int) @pure Function has no side effects and returns same value for same inputs @overload Function is overloaded @llvm Function is implemented with inline LLVM IR

%tmp = icmp eq i64 %a, %b
%res = zext i1 %tmp to i8
ret i8 %res

__ne__(self, b: float) @pure Function has no side effects and returns same value for same inputs @llvm Function is implemented with inline LLVM IR

%0 = sitofp i64 %self to double
%1 = fcmp one double %0, %b
%2 = zext i1 %1 to i8
ret i8 %2

__ne__(a: int, b: int) @pure Function has no side effects and returns same value for same inputs @overload Function is overloaded @llvm Function is implemented with inline LLVM IR

%tmp = icmp ne i64 %a, %b
%res = zext i1 %tmp to i8
ret i8 %res

__lt__(self, b: float) @pure Function has no side effects and returns same value for same inputs @llvm Function is implemented with inline LLVM IR

%0 = sitofp i64 %self to double
%1 = fcmp olt double %0, %b
%2 = zext i1 %1 to i8
ret i8 %2

__lt__(a: int, b: int) @pure Function has no side effects and returns same value for same inputs @overload Function is overloaded @llvm Function is implemented with inline LLVM IR

%tmp = icmp slt i64 %a, %b
%res = zext i1 %tmp to i8
ret i8 %res

__gt__(self, b: float) @pure Function has no side effects and returns same value for same inputs @llvm Function is implemented with inline LLVM IR

%0 = sitofp i64 %self to double
%1 = fcmp ogt double %0, %b
%2 = zext i1 %1 to i8
ret i8 %2

__gt__(a: int, b: int) @pure Function has no side effects and returns same value for same inputs @overload Function is overloaded @llvm Function is implemented with inline LLVM IR

%tmp = icmp sgt i64 %a, %b
%res = zext i1 %tmp to i8
ret i8 %res

__le__(self, b: float) @pure Function has no side effects and returns same value for same inputs @llvm Function is implemented with inline LLVM IR

%0 = sitofp i64 %self to double
%1 = fcmp ole double %0, %b
%2 = zext i1 %1 to i8
ret i8 %2

__le__(a: int, b: int) @pure Function has no side effects and returns same value for same inputs @overload Function is overloaded @llvm Function is implemented with inline LLVM IR

%tmp = icmp sle i64 %a, %b
%res = zext i1 %tmp to i8
ret i8 %res

__ge__(self, b: float) @pure Function has no side effects and returns same value for same inputs @llvm Function is implemented with inline LLVM IR

%0 = sitofp i64 %self to double
%1 = fcmp oge double %0, %b
%2 = zext i1 %1 to i8
ret i8 %2

__ge__(a: int, b: int) @pure Function has no side effects and returns same value for same inputs @overload Function is overloaded @llvm Function is implemented with inline LLVM IR

%tmp = icmp sge i64 %a, %b
%res = zext i1 %tmp to i8
ret i8 %res

__pow__(self, exp: float)

__pow__(self, exp: int) @overload Function is overloaded

__atomic_xchg__(d: Ptr[int], b: int) @nocapture Function does not capture arguments (return value might capture) @llvm Function is implemented with inline LLVM IR

%tmp = atomicrmw xchg ptr %d, i64 %b seq_cst
ret {} {}

__atomic_add__(d: Ptr[int], b: int) @nocapture Function does not capture arguments (return value might capture) @llvm Function is implemented with inline LLVM IR

%tmp = atomicrmw add ptr %d, i64 %b seq_cst
ret i64 %tmp

__atomic_sub__(d: Ptr[int], b: int) @nocapture Function does not capture arguments (return value might capture) @llvm Function is implemented with inline LLVM IR

%tmp = atomicrmw sub ptr %d, i64 %b seq_cst
ret i64 %tmp

__atomic_and__(d: Ptr[int], b: int) @nocapture Function does not capture arguments (return value might capture) @llvm Function is implemented with inline LLVM IR

%tmp = atomicrmw and ptr %d, i64 %b seq_cst
ret i64 %tmp

__atomic_nand__(d: Ptr[int], b: int) @nocapture Function does not capture arguments (return value might capture) @llvm Function is implemented with inline LLVM IR

%tmp = atomicrmw nand ptr %d, i64 %b seq_cst
ret i64 %tmp

__atomic_or__(d: Ptr[int], b: int) @nocapture Function does not capture arguments (return value might capture) @llvm Function is implemented with inline LLVM IR

%tmp = atomicrmw or ptr %d, i64 %b seq_cst
ret i64 %tmp

__atomic_xor__(d: Ptr[int], b: int) @nocapture Function does not capture arguments (return value might capture) @llvm Function is implemented with inline LLVM IR

%tmp = atomicrmw xor ptr %d, i64 %b seq_cst
ret i64 %tmp

__atomic_min__(d: Ptr[int], b: int) @nocapture Function does not capture arguments (return value might capture) @llvm Function is implemented with inline LLVM IR

%tmp = atomicrmw min ptr %d, i64 %b seq_cst
ret i64 %tmp

__atomic_max__(d: Ptr[int], b: int) @nocapture Function does not capture arguments (return value might capture) @llvm Function is implemented with inline LLVM IR

%tmp = atomicrmw max ptr %d, i64 %b seq_cst
ret i64 %tmp

__match__(self, obj: int)

Methods

popcnt(self)