# 2.5.13. Integer¶

TODO.

## 2.5.13.1. Instruction¶

`target = ``decr`` op1`` [integer::Decr]`
Target: int<*> int<*>

Decrements op1 by one.

`target = ``decr_by`` op1 op2`` [integer::DecrBy]`
Target: int<*> int<*> int<*>

Decreases op1 by op2.

`target = ``int.add`` op1 op2`` [integer::Add]`
Target: int<*> int<*> int<*>

Calculates the sum of the two operands. Operands and target must be of same width. The result is calculated modulo 2^{width}.

`target = ``int.and`` op1 op2`` [integer::And]`
Target: int<*> int<*> int<*>

Calculates the binary and of the two operands. Operands and target must be of same width.

`target = ``int.as_interval`` op1`` [integer::AsInterval]`
Target: interval int<*>

Converts the integer op1 into an interval value, interpreting it as seconds.

`target = ``int.as_sdouble`` op1`` [integer::AsSDouble]`
Target: double int<*>

Converts the signed integer op1 into a double value.

`target = ``int.as_time`` op1`` [integer::AsTime]`
Target: time int<*>

Converts the integer op1 into a time value, interpreting it as seconds since the epoch.

`target = ``int.as_udouble`` op1`` [integer::AsUDouble]`
Target: double int<*>

Converts the unsigned integer op1 into a double value.

`target = ``int.ashr`` op1 op2`` [integer::Ashr]`
Target: int<*> int<*> int<*>

Arithmetically shifts op1 to the right by op2 bits. The most- signficant bits are filled with the sign of op1. If the value of op2 is larger than the integer type has bits, the result is undefined.

`target = ``int.div`` op1 op2`` [integer::Div]`
Target: int<*> int<*> int<*>

Divides op1 by op2, flooring the result. Operands and target must be of same width. All integers are treaded as signed. If the product overflows the range of the integer type, the result in undefined. Throws `DivisionByZero` if op2 is zero.

`target = ``int.eq`` op1 op2`` [integer::Eq]`
Target: bool int<*> int<*>

Returns true iff op1 equals op2.

`target = ``int.flip`` op1`` [integer::Flip]`
Target: int<*> int<*>

Reverses the bytes of op1.

`target = ``int.from_host`` op1 op2`` [integer::FromHost]`
Target: int<*> int<*> enum { }

Converts op1 from host byte order to byte order op2.

`target = ``int.mask`` op1 op2 op3`` [integer::Mask]`
Target: int<*> int<*> int<*> int<*>

Extracts the bit range from op2 to op3 (inclusive) from op1 and shifts them so that they align with the least significant bit in the result.

`target = ``int.mod`` op1 op2`` [integer::Mod]`
Target: int<*> int<*> int<*>

Calculates the remainder of dividing op1 by op2. Operands and target must be of same width. Throws `DivisionByZero` if op2 is zero.

`target = ``int.mul`` op1 op2`` [integer::Mul]`
Target: int<*> int<*> int<*>

Multiplies op1 with op2. Operands and target must be of same width. The result is calculated modulo 2^{width}.

`target = ``int.or`` op1 op2`` [integer::Or]`
Target: int<*> int<*> int<*>

Calculates the binary or of the two operands. Operands and target must be of same width.

`target = ``int.pow`` op1 op2`` [integer::Pow]`
Target: int<*> int<*> int<*>

Raise op1 to the power op2. Note that both op1 and op2 are interpreted as unsigned integers. If the result overflows the target’s type, the result is undefined.

`target = ``int.sext`` op1`` [integer::SExt]`
Target: int<*> int<*>

Sign-extends op1 into an integer of the same width as the target. The width of op1 must be smaller or equal that of the target.

`target = ``int.sgeq`` op1 op2`` [integer::Sgeq]`
Target: bool int<*> int<*>

Returns true iff op1 is greater or equal op2, interpreting both as signed integers.

`target = ``int.sgt`` op1 op2`` [integer::Sgt]`
Target: bool int<*> int<*>

Returns true iff op1 is greater than op2, interpreting both as signed integers.

`target = ``int.shl`` op1 op2`` [integer::Shl]`
Target: int<*> int<*> int<*>

Shifts op1 to the left by op2 bits. The least-signficant bits are filled with zeros. If the value of op2 is larger than the integer type has bits, the result is undefined.

`target = ``int.shr`` op1 op2`` [integer::Shr]`
Target: int<*> int<*> int<*>

Shifts op1 to the right by op2 bits. The most-signficant bits are filled with zeros. If the value of op2 is larger than the integer type has bits, the result is undefined.

`target = ``int.sleq`` op1 op2`` [integer::Sleq]`
Target: bool int<*> int<*>

Returns true iff op1 is lower or equal op2, interpreting both as signed integers.

`target = ``int.slt`` op1 op2`` [integer::Slt]`
Target: bool int<*> int<*>

Returns true iff op1 is less than op2, interpreting both as signed integers.

`target = ``int.sub`` op1 op2`` [integer::Sub]`
Target: int<*> int<*> int<*>

Subtracts op2 from op1. Operands and target must be of same width. The result is calculated modulo 2^{width}.

`target = ``int.to_host`` op1 op2`` [integer::ToHost]`
Target: int<*> int<*> enum { }

Converts op1 from byte order op2 into host byte order.

`target = ``int.trunc`` op1`` [integer::Trunc]`
Target: int<*> int<*>

Bit-truncates op1 into an integer of the same width as the target. The width of op1 must be larger or equal that of the target.

`target = ``int.ugeq`` op1 op2`` [integer::Ugeq]`
Target: bool int<*> int<*>

Returns true iff op1 is greater or equal op2, interpreting both as unsigned integers.

`target = ``int.ugt`` op1 op2`` [integer::Ugt]`
Target: bool int<*> int<*>

Returns true iff op1 is greater than op2, interpreting both as unsigned integers.

`target = ``int.uleq`` op1 op2`` [integer::Uleq]`
Target: bool int<*> int<*>

Returns true iff op1 is lower or equal op2, interpreting both as unsigned integers.

`target = ``int.ult`` op1 op2`` [integer::Ult]`
Target: bool int<*> int<*>

Returns true iff op1 is less than op2, interpreting both as unsigned integers.

`target = ``int.xor`` op1 op2`` [integer::Xor]`
Target: int<*> int<*> int<*>

Calculates the binary xor of the two operands. Operands and target must be of same width.

`target = ``int.zext`` op1`` [integer::ZExt]`
Target: int<*> int<*>

Zero-extends op1 into an integer of the same width as the target. The width of op1 must be smaller or equal that of the target.