aboutsummaryrefslogtreecommitdiffstats
path: root/libj2.7
diff options
context:
space:
mode:
authorMattias Andrée <m@maandree.se>2025-12-27 11:29:31 +0100
committerMattias Andrée <m@maandree.se>2025-12-27 11:29:31 +0100
commita72264006b738c8aa3d49d7835a86bcce130d20d (patch)
treee29423bcaaa1341b19ce9febd3f8de9fc0f95983 /libj2.7
parentFix libj2_j2u_add_j2u_overflow_p (diff)
downloadlibj2-a72264006b738c8aa3d49d7835a86bcce130d20d.tar.gz
libj2-a72264006b738c8aa3d49d7835a86bcce130d20d.tar.bz2
libj2-a72264006b738c8aa3d49d7835a86bcce130d20d.tar.xz
Add signed arithmetics
Signed-off-by: Mattias Andrée <m@maandree.se>
Diffstat (limited to '')
-rw-r--r--libj2.7162
1 files changed, 160 insertions, 2 deletions
diff --git a/libj2.7 b/libj2.7
index a5976e5..7275a69 100644
--- a/libj2.7
+++ b/libj2.7
@@ -752,6 +752,18 @@ Set the least significant cleared bit.
.B libj2
provides the following arithmetic functions:
.TP
+.BR libj2_j2i_add_j2i (3),
+.TQ
+.BR libj2_j2i_add_j2i_to_j2i (3),
+.TQ
+.BR libj2_j2i_add_ji (3),
+.TQ
+.BR libj2_j2i_add_ji_to_j2i (3),
+.TQ
+.BR libj2_ji_add_j2i_to_j2i (3),
+.TQ
+.BR libj2_ji_add_ji_to_j2i (3),
+.TQ
.BR libj2_j2u_add_j2u (3),
.TQ
.BR libj2_j2u_add_j2u_to_j2u (3),
@@ -765,6 +777,16 @@ provides the following arithmetic functions:
.BR libj2_ju_add_ju_to_j2u (3)
Calculate the sum of two values.
.TP
+.BR libj2_j2i_add_j2i_overflow (3),
+.TQ
+.BR libj2_j2i_add_j2i_to_j2i_overflow (3),
+.TQ
+.BR libj2_j2i_add_ji_overflow (3),
+.TQ
+.BR libj2_j2i_add_ji_to_j2i_overflow (3),
+.TQ
+.BR libj2_ji_add_j2i_to_j2i_overflow (3),
+.TQ
.BR libj2_j2u_add_j2u_overflow (3),
.TQ
.BR libj2_j2u_add_j2u_to_j2u_overflow (3),
@@ -776,6 +798,12 @@ Calculate the sum of two values.
.BR libj2_ju_add_j2u_to_j2u_overflow (3)
Calculate the sum of two values, and detect overflow.
.TP
+.BR libj2_j2i_add_j2i_overflow_p (3),
+.TQ
+.BR libj2_j2i_add_ji_overflow_p (3),
+.TQ
+.BR libj2_ji_add_j2i_overflow_p (3),
+.TQ
.BR libj2_j2u_add_j2u_overflow_p (3),
.TQ
.BR libj2_j2u_add_ju_overflow_p (3),
@@ -794,6 +822,18 @@ Predict whether adding two values will result in an overflow.
.BR libj2_ju_sat_add_j2u_to_j2u (3)
Calculate the sum of two values, but saturate on overflow.
.TP
+.BR libj2_j2i_sub_j2i (3),
+.TQ
+.BR libj2_j2i_sub_j2i_to_j2i (3),
+.TQ
+.BR libj2_j2i_sub_ji (3),
+.TQ
+.BR libj2_j2i_sub_ji_to_j2i (3),
+.TQ
+.BR libj2_ji_sub_j2i_to_j2i (3),
+.TQ
+.BR libj2_ji_sub_ji_to_j2i (3),
+.TQ
.BR libj2_j2u_sub_j2u (3),
.TQ
.BR libj2_j2u_sub_j2u_to_j2u (3),
@@ -806,13 +846,27 @@ Calculate the sum of two values, but saturate on overflow.
.TQ
.BR libj2_ju_sub_ju_to_j2u (3)
Calculate the difference between two values.
+.TP
+.BR libj2_j2i_rsub_j2i (3),
+.TQ
+.BR libj2_j2i_rsub_ji (3),
.TQ
.BR libj2_j2u_rsub_j2u (3),
.TQ
.BR libj2_j2u_rsub_ju (3)
Calculate the difference between two values. These functions
swap the position of the two operands.
-.TP
+.TQ
+.BR libj2_j2i_sub_j2i_overflow (3),
+.TQ
+.BR libj2_j2i_sub_j2i_to_j2i_overflow (3),
+.TQ
+.BR libj2_j2i_sub_ji_overflow (3),
+.TQ
+.BR libj2_j2i_sub_ji_to_j2i_overflow (3),
+.TQ
+.BR libj2_ji_sub_j2i_to_j2i_overflow (3),
+.TQ
.BR libj2_j2u_sub_j2u_overflow (3),
.TQ
.BR libj2_j2u_sub_j2u_to_j2u_overflow (3),
@@ -826,13 +880,23 @@ swap the position of the two operands.
.BR libj2_ju_sub_ju_to_j2u_overflow (3)
Calculate the difference between two values, and detect
overflow.
-.TP
+.TQ
+.BR libj2_j2i_rsub_j2i_overflow (3),
+.TQ
+.BR libj2_j2i_rsub_ji_overflow (3),
+.TQ
.BR libj2_j2u_rsub_j2u_overflow (3),
.TQ
.BR libj2_j2u_rsub_ju_overflow (3)
Calculate the difference between two values, and detect
overflow. These functions swap the position of the two operands.
.TP
+.BR libj2_j2i_sub_j2i_overflow_p (3),
+.TQ
+.BR libj2_j2i_sub_ji_overflow_p (3),
+.TQ
+.BR libj2_ji_sub_j2i_overflow_p (3),
+.TQ
.BR libj2_j2u_sub_j2u_overflow_p (3),
.TQ
.BR libj2_j2u_sub_ju_overflow_p (3),
@@ -842,6 +906,10 @@ overflow. These functions swap the position of the two operands.
.BR libj2_ju_sub_ju_overflow_p (3)
Predict whether subtracting a value will result in an overflow.
.TP
+.BR libj2_j2i_rsub_j2i_overflow_p (3),
+.TQ
+.BR libj2_j2i_rsub_ji_overflow_p (3),
+.TQ
.BR libj2_j2u_rsub_j2u_overflow_p (3),
.TQ
.BR libj2_j2u_rsub_ju_overflow_p (3)
@@ -868,6 +936,18 @@ overflow.
Calculate the difference between two values, but saturate on
overflow. These functions swap the position of the two operands.
.TP
+.BR libj2_j2i_mul_j2i (3),
+.TQ
+.BR libj2_j2i_mul_j2i_to_j2i (3),
+.TQ
+.BR libj2_j2i_mul_ji (3),
+.TQ
+.BR libj2_j2i_mul_ji_to_j2i (3),
+.TQ
+.BR libj2_ji_mul_j2i_to_j2i (3),
+.TQ
+.BR libj2_ji_mul_ji_to_j2i (3),
+.TQ
.BR libj2_j2u_mul_j2u (3),
.TQ
.BR libj2_j2u_mul_j2u_to_j2u (3),
@@ -883,6 +963,16 @@ overflow. These functions swap the position of the two operands.
.BR libj2_j2u_mul_j2u_destructive (3)
Calculate the product of two values.
.TP
+.BR libj2_j2i_mul_j2i_overflow (3),
+.TQ
+.BR libj2_j2i_mul_j2i_to_j2i_overflow (3),
+.TQ
+.BR libj2_j2i_mul_ji_overflow (3),
+.TQ
+.BR libj2_j2i_mul_ji_to_j2i_overflow (3),
+.TQ
+.BR libj2_ji_mul_j2i_to_j2i_overflow (3),
+.TQ
.BR libj2_j2u_mul_j2u_overflow (3),
.TQ
.BR libj2_j2u_mul_j2u_to_j2u_overflow (3),
@@ -896,6 +986,12 @@ Calculate the product of two values.
.BR libj2_j2u_mul_j2u_overflow_destructive (3)
Calculate the product of two values, and detect overflow.
.TP
+.BR libj2_j2i_mul_j2i_overflow_p (3),
+.TQ
+.BR libj2_j2i_mul_ji_overflow_p (3),
+.TQ
+.BR libj2_ji_mul_j2i_overflow_p (3),
+.TQ
.BR libj2_j2u_mul_j2u_overflow_p (3),
.TQ
.BR libj2_j2u_mul_ju_overflow_p (3),
@@ -904,6 +1000,12 @@ Calculate the product of two values, and detect overflow.
Predict whether multiplying two values will result in an
overflow.
.TP
+.BR libj2_j2i_mul_j2i_overflow_p_quick (3),
+.TQ
+.BR libj2_j2i_mul_ji_overflow_p_quick (3),
+.TQ
+.BR libj2_ji_mul_j2i_overflow_p_quick (3),
+.TQ
.BR libj2_j2u_mul_j2u_overflow_p_quick (3),
.TQ
.BR libj2_j2u_mul_ju_overflow_p_quick (3),
@@ -912,6 +1014,12 @@ overflow.
Predict whether multiplying two values will result in an
overflow, but do not preform the prediction if it is costly.
.TP
+.BR libj2_j2i_mul_j2i_to_j2i_overflow_p (3),
+.TQ
+.BR libj2_j2i_mul_ji_to_j2i_overflow_p (3),
+.TQ
+.BR libj2_ji_mul_j2i_to_j2i_overflow_p (3),
+.TQ
.BR libj2_j2u_mul_j2u_to_j2u_overflow_p (3),
.TQ
.BR libj2_j2u_mul_ju_to_j2u_overflow_p (3),
@@ -934,6 +1042,18 @@ multiplication.
.BR libj2_j2u_sat_mul_j2u_destructive (3)
Calculate the product of two values, but saturate on overflow.
.TP
+.BR libj2_j2i_divmod_j2i (3),
+.TQ
+.BR libj2_j2i_divmod_j2i_to_j2i (3),
+.TQ
+.BR libj2_j2i_divmod_j2i_to_j2i_j2i (3),
+.TQ
+.BR libj2_j2i_divmod_ji (3),
+.TQ
+.BR libj2_j2i_divmod_ji_to_j2i (3),
+.TQ
+.BR libj2_j2i_divmod_ji_to_j2i_j2i (3),
+.TQ
.BR libj2_j2u_divmod_j2u (3),
.TQ
.BR libj2_j2u_divmod_j2u_to_j2u (3),
@@ -948,12 +1068,28 @@ Calculate the product of two values, but saturate on overflow.
Calculate the ratio between values, and keep the computed
remainder.
.TP
+.BR libj2_j2i_rdivmod_j2i (3),
+.TQ
+.BR libj2_j2i_rdivmod_j2i_to_j2i (3),
+.TQ
.BR libj2_j2u_rdivmod_j2u (3),
.TQ
.BR libj2_j2u_rdivmod_j2u_to_j2u (3)
Calculate the ratio between values, and keep the computed
remainder. These functions swap the position of the two
operands.
+.TP
+.BR libj2_j2i_div_j2i (3),
+.TQ
+.BR libj2_j2i_div_j2i_to_j2i (3),
+.TQ
+.BR libj2_j2i_div_j2i_return (3),
+.TQ
+.BR libj2_j2i_div_ji (3),
+.TQ
+.BR libj2_j2i_div_ji_to_j2i (3),
+.TQ
+.BR libj2_j2i_div_ji_return (3),
.TQ
.BR libj2_j2u_div_j2u (3),
.TQ
@@ -969,11 +1105,21 @@ operands.
Calculate the ratio between values, and discard the
computed remainder.
.TP
+.BR libj2_j2i_rdiv_j2i (3),
+.TQ
.BR libj2_j2u_rdiv_j2u (3)
Calculate the ratio between values, and discard the
computed remainder. This function swaps the position of the two
operands.
.TP
+.BR libj2_j2i_div_j2i_to_j2i_underflow (3),
+.TQ
+.BR libj2_j2i_div_j2i_underflow (3),
+.TQ
+.BR libj2_j2i_div_ji_to_j2i_underflow (3),
+.TQ
+.BR libj2_j2i_div_ji_underflow (3),
+.TQ
.BR libj2_j2u_div_j2u_to_j2u_underflow (3),
.TQ
.BR libj2_j2u_div_j2u_underflow (3),
@@ -984,11 +1130,21 @@ operands.
Calculate the ratio between values, and discard the
computed remainder, but detect underflow (non-zero remainder).
.TP
+.BR libj2_j2i_rdiv_j2i_underflow (3),
+.TQ
.BR libj2_j2u_rdiv_j2u_underflow (3)
Calculate the ratio between values, and discard the
computed remainder, but detect underflow (non-zero remainder).
This function swaps the position of the two operands.
.TP
+.BR libj2_j2i_mod_j2i (3),
+.TQ
+.BR libj2_j2i_mod_j2i_to_j2i (3),
+.TQ
+.BR libj2_j2i_mod_ji (3),
+.TQ
+.BR libj2_j2i_mod_ji_to_j2i (3),
+.TQ
.BR libj2_j2u_mod_j2u (3),
.TQ
.BR libj2_j2u_mod_j2u_to_j2u (3),
@@ -999,6 +1155,8 @@ This function swaps the position of the two operands.
Calculate the remainder of the integer division between two
values.
.TP
+.BR libj2_j2i_rmod_j2i (3),
+.TQ
.BR libj2_j2u_rmod_j2u (3)
Calculate the remainder of the integer division between two
values. This function swaps the position of the two operands.