diff options
Diffstat (limited to '')
30 files changed, 243 insertions, 24 deletions
@@ -512,9 +512,9 @@ SUBHDR =\ libj2/constants.h\ libj2/signum.h\ libj2/constructors.h\ - libj2/unsigned-comparsion.h\ - libj2/signed-comparsion.h\ - libj2/mixed-comparsion.h\ + libj2/unsigned-comparison.h\ + libj2/signed-comparison.h\ + libj2/mixed-comparison.h\ libj2/bitwise-logic.h\ libj2/sign-shifting.h\ libj2/bit-shifting.h\ @@ -48,13 +48,13 @@ DESCRIPTION libj2_minus_abs_j2i(3), libj2_minus_abs_j2i_to_j2i(3) Calculate the additive inverse of the absolute value. - libj2 provides the following comparsion functions: + libj2 provides the following comparison functions: libj2_j2i_cmp_j2i(3), libj2_j2i_cmp_ji(3), libj2_ji_cmp_j2i(3), libj2_j2i_cmp_j2u(3), libj2_j2i_cmp_ju(3), libj2_ji_cmp_j2u(3), libj2_j2u_cmp_j2i(3), libj2_j2u_cmp_ji(3), libj2_ju_cmp_j2i(3), libj2_j2u_cmp_j2u(3), libj2_j2u_cmp_ju(3), libj2_ju_cmp_j2u(3) - Perform three-way comparision. + Perform three-way comparison. libj2_j2i_eq_j2i(3), libj2_j2i_eq_ji(3), libj2_ji_eq_j2i(3), libj2_j2i_eq_j2u(3), libj2_j2i_eq_ju(3), libj2_ji_eq_j2u(3), @@ -110,7 +110,7 @@ DESCRIPTION Check whether a value is negative. libj2_sgn_j2i(3), libj2_sgn_j2u(3) - Perform three-way comparision against the value zero (get the + Perform three-way comparison against the value zero (get the signum of a value). libj2_j2i_max_j2i(3), libj2_j2i_max_j2i_to_j2i(3), @@ -91,7 +91,7 @@ Calculate the additive inverse. Calculate the additive inverse of the absolute value. .PP .B libj2 -provides the following comparsion functions: +provides the following comparison functions: .TP .BR libj2_j2i_cmp_j2i (3), .TQ @@ -116,7 +116,7 @@ provides the following comparsion functions: .BR libj2_j2u_cmp_ju (3), .TQ .BR libj2_ju_cmp_j2u (3) -Perform three-way comparision. +Perform three-way comparison. .TP .BR libj2_j2i_eq_j2i (3), .TQ @@ -296,7 +296,7 @@ Check whether a value is negative. .BR libj2_sgn_j2i (3), .TQ .BR libj2_sgn_j2u (3) -Perform three-way comparision against the value zero (get the +Perform three-way comparison against the value zero (get the signum of a value). .TP .BR libj2_j2i_max_j2i (3), @@ -155,9 +155,9 @@ enum libj2_overflow { #include "libj2/constants.h" #include "libj2/signum.h" #include "libj2/constructors.h" -#include "libj2/unsigned-comparsion.h" -#include "libj2/signed-comparsion.h" -#include "libj2/mixed-comparsion.h" +#include "libj2/unsigned-comparison.h" +#include "libj2/signed-comparison.h" +#include "libj2/mixed-comparison.h" #include "libj2/bitwise-logic.h" #include "libj2/sign-shifting.h" #include "libj2/bit-shifting.h" diff --git a/libj2/mixed-comparsion.h b/libj2/mixed-comparison.h index dedf18d..dedf18d 100644 --- a/libj2/mixed-comparsion.h +++ b/libj2/mixed-comparison.h diff --git a/libj2/sign-shifting.h b/libj2/sign-shifting.h index 7f57136..75a4620 100644 --- a/libj2/sign-shifting.h +++ b/libj2/sign-shifting.h @@ -93,7 +93,7 @@ libj2_minus_j2i(struct libj2_j2i *a) * `libj2_minus_j2i_to_j2u(a, res)` implements * `*res = -*a` * - * Overflows if `libj2_j2i_is_min(a) || libj2_j2i_is_positive(a)` + * Overflows if `libj2_j2i_is_positive(a)` * * @param a The integer to invert * @param res Output parameter for the inverse diff --git a/libj2/signed-comparsion.h b/libj2/signed-comparison.h index 1bed2f1..1bed2f1 100644 --- a/libj2/signed-comparsion.h +++ b/libj2/signed-comparison.h diff --git a/libj2/unsigned-comparsion.h b/libj2/unsigned-comparison.h index c13397a..c13397a 100644 --- a/libj2/unsigned-comparsion.h +++ b/libj2/unsigned-comparison.h diff --git a/libj2_abs_j2i.3 b/libj2_abs_j2i.3 new file mode 100644 index 0000000..ca5d885 --- /dev/null +++ b/libj2_abs_j2i.3 @@ -0,0 +1,68 @@ +.TH LIBJ2_ABS_J2I 3 LIBJ2 +.SH NAME +libj2_abs_j2i \- Calculate absolute value + +.SH SYNOPSIS +.nf +#include <libj2.h> + +void \fBlibj2_abs_j2i\fP(struct libj2_j2i *\fIa\fP); +void \fBlibj2_abs_j2i_to_j2i\fP(const struct libj2_j2i *\fIa\fP, struct libj2_j2i *\fIr\fP); +void \fBlibj2_abs_j2i_to_j2u\fP(const struct libj2_j2i *\fIa\fP, struct libj2_j2u *\fIr\fP); +.fi +.PP +Link with +.IR -lj2 . + +.SH DESCRIPTION +The +.BR libj2_abs_j2i (), +.BR libj2_abs_j2i_to_j2i (), +and +.BR libj2_abs_j2i_to_j2u () +functions calculate the absolute value of +.IR a . +.PP +The +.BR libj2_abs_j2i () +function stores the result in +.IR a . +.PP +The +.BR libj2_abs_j2i_to_j2i () +and +.BR libj2_abs_j2i_to_j2u () +function stores the result in +.IR r . +.PP +In the case that +.I a +is the minimum representable value, the +calculation of the +.BR libj2_abs_j2i () +and +.BR libj2_abs_j2i_to_j2i () +functions overflow to the input value. +.PP +The arguments are assumed to be +.RI non- NULL . + +.SH RETURN VALUE +None. + +.SH ERRORS +The above listed functions cannot fail. + +.SH HISTORY +The +.BR libj2_abs_j2i (), +.BR libj2_abs_j2i_to_j2i (), +and +.BR libj2_abs_j2i_to_j2u () +functions were added in version 1.1 of +.BR libj2 . + +.SH SEE ALSO +.BR libj2 (7), +.BR libj2_minus_j2i (3), +.BR libj2_minus_abs_j2i (3) diff --git a/libj2_abs_j2i.c b/libj2_abs_j2i.c index 999ff8b..e3c9d33 100644 --- a/libj2_abs_j2i.c +++ b/libj2_abs_j2i.c @@ -3,7 +3,6 @@ #ifndef TEST extern inline void libj2_abs_j2i(struct libj2_j2i *a); -/* TODO Add man page */ #else diff --git a/libj2_abs_j2i_to_j2i.3 b/libj2_abs_j2i_to_j2i.3 new file mode 120000 index 0000000..f5881fe --- /dev/null +++ b/libj2_abs_j2i_to_j2i.3 @@ -0,0 +1 @@ +libj2_abs_j2i.3
\ No newline at end of file diff --git a/libj2_abs_j2i_to_j2i.c b/libj2_abs_j2i_to_j2i.c index 00776ce..bbbc511 100644 --- a/libj2_abs_j2i_to_j2i.c +++ b/libj2_abs_j2i_to_j2i.c @@ -3,7 +3,6 @@ #ifndef TEST extern inline void libj2_abs_j2i_to_j2i(const struct libj2_j2i *a, struct libj2_j2i *res); -/* TODO Add man page */ #else diff --git a/libj2_abs_j2i_to_j2u.3 b/libj2_abs_j2i_to_j2u.3 new file mode 120000 index 0000000..f5881fe --- /dev/null +++ b/libj2_abs_j2i_to_j2u.3 @@ -0,0 +1 @@ +libj2_abs_j2i.3
\ No newline at end of file diff --git a/libj2_abs_j2i_to_j2u.c b/libj2_abs_j2i_to_j2u.c index a50de01..e1f8876 100644 --- a/libj2_abs_j2i_to_j2u.c +++ b/libj2_abs_j2i_to_j2u.c @@ -3,7 +3,6 @@ #ifndef TEST extern inline void libj2_abs_j2i_to_j2u(const struct libj2_j2i *a, struct libj2_j2u *res); -/* TODO Add man page */ #else diff --git a/libj2_minus_abs_j2i.3 b/libj2_minus_abs_j2i.3 new file mode 100644 index 0000000..f750ce3 --- /dev/null +++ b/libj2_minus_abs_j2i.3 @@ -0,0 +1,55 @@ +.TH LIBJ2_MINUS_ABS_J2I 3 LIBJ2 +.SH NAME +libj2_minus_abs_j2i \- Calculate the additive inverse of the absolute value + +.SH SYNOPSIS +.nf +#include <libj2.h> + +void \fBlibj2_minus_abs_j2i\fP(struct libj2_j2i *\fIa\fP); +void \fBlibj2_minus_abs_j2i_to_j2i\fP(const struct libj2_j2i *\fIa\fP, struct libj2_j2i *\fIr\fP); +.fi +.PP +Link with +.IR -lj2 . + +.SH DESCRIPTION +The +.BR libj2_minus_abs_j2i () +and +.BR libj2_minus_abs_j2i_to_j2i () +functions calculate the additive inverse +of the absolute value of +.IR a . +.PP +The +.BR libj2_minus_abs_j2i () +function stores the result in +.IR a . +.PP +The +.BR libj2_minus_abs_j2i_to_j2i () +function stores the result in +.IR r . +.PP +The arguments are assumed to be +.RI non- NULL . + +.SH RETURN VALUE +None. + +.SH ERRORS +The above listed functions cannot fail. + +.SH HISTORY +The +.BR libj2_minus_abs_j2i () +and +.BR libj2_minus_abs_j2i_to_j2i () +functions were added in version 1.1 of +.BR libj2 . + +.SH SEE ALSO +.BR libj2 (7), +.BR libj2_abs_j2i (3), +.BR libj2_minus_j2i (3) diff --git a/libj2_minus_abs_j2i.c b/libj2_minus_abs_j2i.c index d2f56b4..1d3ab90 100644 --- a/libj2_minus_abs_j2i.c +++ b/libj2_minus_abs_j2i.c @@ -3,7 +3,6 @@ #ifndef TEST extern inline void libj2_minus_abs_j2i(struct libj2_j2i *a); -/* TODO Add man page */ #else diff --git a/libj2_minus_abs_j2i_to_j2i.3 b/libj2_minus_abs_j2i_to_j2i.3 new file mode 120000 index 0000000..2c9c672 --- /dev/null +++ b/libj2_minus_abs_j2i_to_j2i.3 @@ -0,0 +1 @@ +libj2_minus_abs_j2i.3
\ No newline at end of file diff --git a/libj2_minus_abs_j2i_to_j2i.c b/libj2_minus_abs_j2i_to_j2i.c index 8f41cab..d082049 100644 --- a/libj2_minus_abs_j2i_to_j2i.c +++ b/libj2_minus_abs_j2i_to_j2i.c @@ -3,7 +3,6 @@ #ifndef TEST extern inline void libj2_minus_abs_j2i_to_j2i(const struct libj2_j2i *a, struct libj2_j2i *res); -/* TODO Add man page */ #else diff --git a/libj2_minus_j2i.3 b/libj2_minus_j2i.3 new file mode 100644 index 0000000..64aeda7 --- /dev/null +++ b/libj2_minus_j2i.3 @@ -0,0 +1,99 @@ +.TH LIBJ2_MINUS_J2I 3 LIBJ2 +.SH NAME +libj2_minus_j2i \- Additively inverse + +.SH SYNOPSIS +.nf +#include <libj2.h> + +void \fBlibj2_minus_j2i\fP(struct libj2_j2i *\fIa\fP); +void \fBlibj2_minus_j2i_to_j2i\fP(const struct libj2_j2i *\fIa\fP, struct libj2_j2i *\fIr\fP); +void \fBlibj2_minus_j2i_to_j2u\fP(const struct libj2_j2i *\fIa\fP, struct libj2_j2u *\fIr\fP); +void \fBlibj2_minus_j2u\fP(struct libj2_j2u *\fIa\fP); +void \fBlibj2_minus_j2u_to_j2i\fP(const struct libj2_j2u *\fIa\fP, struct libj2_j2i *\fIr\fP); +void \fBlibj2_minus_j2u_to_j2u\fP(const struct libj2_j2u *\fIa\fP, struct libj2_j2u *\fIr\fP); +.fi +.PP +Link with +.IR -lj2 . + +.SH DESCRIPTION +The +.BR libj2_minus_j2i () +and +.BR libj2_minus_j2u () +functions additively inverse the value of +.IR a . +.PP +The +.BR libj2_minus_j2i_to_j2i (), +.BR libj2_minus_j2i_to_j2u (), +.BR libj2_minus_j2u_to_j2i (), +and +.BR libj2_minus_j2u_to_j2u (), +functions calculate the additive inverse +of the value of +.I a +and store the result in +.IR r . +.PP +In the case that +.I a +is the minimum representable value, the +calculation of the +.BR libj2_minus_j2i () +and +.BR libj2_minus_j2i_to_j2i () +functions overflow to the input value. +.PP +In the case that +.I a +is positive, the calculation of the +.BR libj2_minus_j2i_to_j2u () +function technically overflows, however +the result is as if +.I a +was converted to +.B struct libj2_j2i +and then inverted. +.PP +In the case that +.I a +has its most significant bit set in +addition to at least one other bit, +that is if +.IR "libj2_co_j2u(a) > 1U && libj2_j2u_test_bit(a, LIBJ2_J2U_BIT - 1U)" , +the calculation of the +.BR libj2_minus_j2u_to_j2i () +function overflows to the input value. +.PP +The arguments are assumed to be +.RI non- NULL . + +.SH RETURN VALUE +None. + +.SH ERRORS +The above listed functions cannot fail. + +.SH HISTORY +The +.BR libj2_minus_j2u () +and +.BR libj2_minus_j2u_to_j2u () +functions were added in version 1.0 of +.BR libj2 . +.PP +The +.BR libj2_minus_j2i (), +.BR libj2_minus_j2i_to_j2i (), +.BR libj2_minus_j2i_to_j2u (), +and +.BR libj2_minus_j2u_to_j2i () +functions were added in version 1.1 of +.BR libj2 . + +.SH SEE ALSO +.BR libj2 (7), +.BR libj2_abs_j2i (3), +.BR libj2_minus_abs_j2i (3) diff --git a/libj2_minus_j2i.c b/libj2_minus_j2i.c index 805afde..a1c0d62 100644 --- a/libj2_minus_j2i.c +++ b/libj2_minus_j2i.c @@ -3,7 +3,6 @@ #ifndef TEST extern inline void libj2_minus_j2i(struct libj2_j2i *a); -/* TODO Add man page */ #else diff --git a/libj2_minus_j2i_to_j2i.3 b/libj2_minus_j2i_to_j2i.3 new file mode 120000 index 0000000..824efb3 --- /dev/null +++ b/libj2_minus_j2i_to_j2i.3 @@ -0,0 +1 @@ +libj2_minus_j2i.3
\ No newline at end of file diff --git a/libj2_minus_j2i_to_j2i.c b/libj2_minus_j2i_to_j2i.c index 01e559a..f0482be 100644 --- a/libj2_minus_j2i_to_j2i.c +++ b/libj2_minus_j2i_to_j2i.c @@ -3,7 +3,6 @@ #ifndef TEST extern inline void libj2_minus_j2i_to_j2i(const struct libj2_j2i *a, struct libj2_j2i *res); -/* TODO Add man page */ #else diff --git a/libj2_minus_j2i_to_j2u.3 b/libj2_minus_j2i_to_j2u.3 new file mode 120000 index 0000000..824efb3 --- /dev/null +++ b/libj2_minus_j2i_to_j2u.3 @@ -0,0 +1 @@ +libj2_minus_j2i.3
\ No newline at end of file diff --git a/libj2_minus_j2i_to_j2u.c b/libj2_minus_j2i_to_j2u.c index 5e570a5..46837d0 100644 --- a/libj2_minus_j2i_to_j2u.c +++ b/libj2_minus_j2i_to_j2u.c @@ -3,7 +3,6 @@ #ifndef TEST extern inline void libj2_minus_j2i_to_j2u(const struct libj2_j2i *a, struct libj2_j2u *res); -/* TODO Add man page */ #else diff --git a/libj2_minus_j2u.3 b/libj2_minus_j2u.3 new file mode 120000 index 0000000..824efb3 --- /dev/null +++ b/libj2_minus_j2u.3 @@ -0,0 +1 @@ +libj2_minus_j2i.3
\ No newline at end of file diff --git a/libj2_minus_j2u.c b/libj2_minus_j2u.c index f19c5b7..a141bbf 100644 --- a/libj2_minus_j2u.c +++ b/libj2_minus_j2u.c @@ -3,7 +3,6 @@ #ifndef TEST extern inline void libj2_minus_j2u(struct libj2_j2u *a); -/* TODO Add man page */ #else diff --git a/libj2_minus_j2u_to_j2i.3 b/libj2_minus_j2u_to_j2i.3 new file mode 120000 index 0000000..824efb3 --- /dev/null +++ b/libj2_minus_j2u_to_j2i.3 @@ -0,0 +1 @@ +libj2_minus_j2i.3
\ No newline at end of file diff --git a/libj2_minus_j2u_to_j2i.c b/libj2_minus_j2u_to_j2i.c index b453bfb..55a229a 100644 --- a/libj2_minus_j2u_to_j2i.c +++ b/libj2_minus_j2u_to_j2i.c @@ -3,7 +3,6 @@ #ifndef TEST extern inline void libj2_minus_j2u_to_j2i(const struct libj2_j2u *a, struct libj2_j2i *res); -/* TODO Add man page */ #else diff --git a/libj2_minus_j2u_to_j2u.3 b/libj2_minus_j2u_to_j2u.3 new file mode 120000 index 0000000..824efb3 --- /dev/null +++ b/libj2_minus_j2u_to_j2u.3 @@ -0,0 +1 @@ +libj2_minus_j2i.3
\ No newline at end of file diff --git a/libj2_minus_j2u_to_j2u.c b/libj2_minus_j2u_to_j2u.c index 1198d4e..2339073 100644 --- a/libj2_minus_j2u_to_j2u.c +++ b/libj2_minus_j2u_to_j2u.c @@ -3,7 +3,6 @@ #ifndef TEST extern inline void libj2_minus_j2u_to_j2u(const struct libj2_j2u *a, struct libj2_j2u *res); -/* TODO Add man page */ #else |
