From 22db7c7726365f534e33036bff03d9363407f3e0 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Sun, 18 Jan 2026 12:46:09 +0100 Subject: Add lrot and rrot man pages MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- libj2_j2i_lsh.3 | 19 +++++++++++--- libj2_j2i_rsh.3 | 19 +++++++++++--- libj2_j2u_lrot.3 | 76 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ libj2_j2u_lrot.c | 5 ---- libj2_j2u_rrot.3 | 76 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ libj2_j2u_rrot.c | 5 ---- 6 files changed, 184 insertions(+), 16 deletions(-) create mode 100644 libj2_j2u_lrot.3 create mode 100644 libj2_j2u_rrot.3 diff --git a/libj2_j2i_lsh.3 b/libj2_j2i_lsh.3 index ed67470..ce5885e 100644 --- a/libj2_j2i_lsh.3 +++ b/libj2_j2i_lsh.3 @@ -56,6 +56,20 @@ only predict overflow, and do not perform any bit-shifting, and therefore does store it anywhere. .PP +For the functions where +.I a +is a +.B uintmax_t +it is convert to a +.BR "struct libj2_j2u *" , +and for the functions where +.I a +is a +.B intmax_t +it is convert to a +.BR "struct libj2_j2i *" , +before described operations. +.PP The value-returning functions (that is, those with word .B overflow @@ -63,7 +77,6 @@ in their name), detect overflow, that is, if any discarded bit (any of the .I b most significant bits) was set. - .PP The arguments are assumed to be .RI non- NULL . @@ -110,5 +123,5 @@ functions were added in version 1.1 of .SH SEE ALSO .BR libj2 (7), .BR libj2_j2i_rsh (3), -.BR libj2_j2i_lrot (3), -.BR libj2_j2i_rrot (3) +.BR libj2_j2u_lrot (3), +.BR libj2_j2u_rrot (3) diff --git a/libj2_j2i_rsh.3 b/libj2_j2i_rsh.3 index d83b310..f5c6061 100644 --- a/libj2_j2i_rsh.3 +++ b/libj2_j2i_rsh.3 @@ -63,6 +63,20 @@ only predict underflow, and do not perform any bit-shifting, and therefore does store it anywhere. .PP +For the functions where +.I a +is a +.B uintmax_t +it is convert to a +.BR "struct libj2_j2u *" , +and for the functions where +.I a +is a +.B intmax_t +it is convert to a +.BR "struct libj2_j2i *" , +before described operations. +.PP The value-returning functions (that is, those with word .B underflow @@ -70,7 +84,6 @@ in their name), detect underflow, that is, if any discarded bit (any of the .I b most significant bits) was set. - .PP The arguments are assumed to be .RI non- NULL . @@ -117,5 +130,5 @@ functions were added in version 1.1 of .SH SEE ALSO .BR libj2 (7), .BR libj2_j2i_lsh (3), -.BR libj2_j2i_lrot (3), -.BR libj2_j2i_rrot (3) +.BR libj2_j2u_lrot (3), +.BR libj2_j2u_rrot (3) diff --git a/libj2_j2u_lrot.3 b/libj2_j2u_lrot.3 new file mode 100644 index 0000000..8c089e2 --- /dev/null +++ b/libj2_j2u_lrot.3 @@ -0,0 +1,76 @@ +.TH LIBJ2_J2U_LROT 3 LIBJ2 +.SH NAME +libj2_j2u_lrot \- Left-rotate bits + +.SH SYNOPSIS +.nf +#include + +void \fBlibj2_j2u_lrot\fP(struct libj2_j2u *\fIa\fP, unsigned \fIb\fP); +void \fBlibj2_j2u_lrot_to_j2u\fP(const struct libj2_j2u *\fIa\fP, unsigned \fIb\fP, struct libj2_j2u *\fIr\fP); +void \fBlibj2_ju_lrot_to_j2u\fP(uintmax_t \fIa\fP, unsigned \fIb\fP, struct libj2_j2u *\fIr\fP); +.fi +.PP +Link with +.IR -lj2 . + +.SH DESCRIPTION +The +.BR libj2_j2u_lrot () +function shifts each bit in +.I a +to +.I b +more significant positions; the +.I b +most significant bits are moved +to the +.I b +least significant positions with +preserved significance relative to +each other. The result is written +back to +.IR a . +.PP +The +.BR libj2_j2u_lrot_to_j2u () +function modifies +.I a +likewise, but writes the result to +.I r +rather than +.IR a . +.PP +The +.BR libj2_ju_lrot_to_j2u () +function is equivalent to the +.BR libj2_j2u_lrot_to_j2u () +function, except +.I a +is converted to a +.B struct libj2_j2u * +before the modification takes place. +.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_j2u_lrot (), +.BR libj2_j2u_lrot_to_j2u (), +and +.BR libj2_ju_lrot_to_j2u () +functions were added in version 1.0 of +.BR libj2 . + +.SH SEE ALSO +.BR libj2 (7), +.BR libj2_j2u_rrot (3), +.BR libj2_j2i_lsh (3), +.BR libj2_j2i_rsh (3) diff --git a/libj2_j2u_lrot.c b/libj2_j2u_lrot.c index 647ddba..fe73abc 100644 --- a/libj2_j2u_lrot.c +++ b/libj2_j2u_lrot.c @@ -3,11 +3,6 @@ #ifndef TEST extern inline void libj2_j2u_lrot(struct libj2_j2u *a, unsigned b); -/* TODO Add man pages - libj2_j2u_lrot - libj2_j2u_lrot_to_j2u - libj2_ju_lrot_to_j2u - */ #else diff --git a/libj2_j2u_rrot.3 b/libj2_j2u_rrot.3 new file mode 100644 index 0000000..4f3f52f --- /dev/null +++ b/libj2_j2u_rrot.3 @@ -0,0 +1,76 @@ +.TH LIBJ2_J2U_RROT 3 LIBJ2 +.SH NAME +libj2_j2u_rrot \- Right-rotate bits + +.SH SYNOPSIS +.nf +#include + +void \fBlibj2_j2u_rrot\fP(struct libj2_j2u *\fIa\fP, unsigned \fIb\fP); +void \fBlibj2_j2u_rrot_to_j2u\fP(const struct libj2_j2u *\fIa\fP, unsigned \fIb\fP, struct libj2_j2u *\fIr\fP); +void \fBlibj2_ju_rrot_to_j2u\fP(uintmax_t \fIa\fP, unsigned \fIb\fP, struct libj2_j2u *\fIr\fP); +.fi +.PP +Link with +.IR -lj2 . + +.SH DESCRIPTION +The +.BR libj2_j2u_rrot () +function shifts each bit in +.I a +to +.I b +less significant positions; the +.I b +least significant bits are moved +to the +.I b +most significant positions with +preserved significance relative to +each other. The result is written +back to +.IR a . +.PP +The +.BR libj2_j2u_rrot_to_j2u () +function modifies +.I a +likewise, but writes the result to +.I r +rather than +.IR a . +.PP +The +.BR libj2_ju_rrot_to_j2u () +function is equivalent to the +.BR libj2_j2u_rrot_to_j2u () +function, except +.I a +is converted to a +.B struct libj2_j2u * +before the modification takes place. +.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_j2u_rrot (), +.BR libj2_j2u_rrot_to_j2u (), +and +.BR libj2_ju_rrot_to_j2u () +functions were added in version 1.0 of +.BR libj2 . + +.SH SEE ALSO +.BR libj2 (7), +.BR libj2_j2u_lrot (3), +.BR libj2_j2i_lsh (3), +.BR libj2_j2i_rsh (3) diff --git a/libj2_j2u_rrot.c b/libj2_j2u_rrot.c index 923bc0a..633ff8a 100644 --- a/libj2_j2u_rrot.c +++ b/libj2_j2u_rrot.c @@ -3,11 +3,6 @@ #ifndef TEST extern inline void libj2_j2u_rrot(struct libj2_j2u *a, unsigned b); -/* TODO Add man pages - libj2_j2u_rrot - libj2_j2u_rrot_to_j2u - libj2_ju_rrot_to_j2u - */ #else -- cgit v1.2.3-70-g09d2