author: kx <kx@radix-linux.su> 2024-12-28 08:20:38 +0300
committer: kx <kx@radix-linux.su> 2024-12-28 08:20:38 +0300
commit: 07a2b4814e54523bee9733655d165dfa70643565
parent: 055ab71005847fee9aefff8f22be05c3b1ced684
Commit Summary:
Diffstat:
1 file changed, 53 insertions, 0 deletions
diff --git a/man/iadd.3mpu b/man/iadd.3mpu
new file mode 100644
index 0000000..d89694b
--- /dev/null
+++ b/man/iadd.3mpu
@@ -0,0 +1,61 @@
+.\" Copyright 2024 Andrew V.Kosteltsev (kx@radix-linux.su)
+.\"
+.\"
+.TH iadd 3 "December 27, 2024" "libmpu" "LibMPU Programmer's Manual"
+.SH NAME
+\fBiadd\fP \- signed and unsigned addition
+.SH SYNOPSIS
+.nf
+.B #include <libmpu.h>
+.PP
+.BI "void iadd( mpu_int *" c ", mpu_int *" a ", mpu_int *" b ", int " nb " );
+.fi
+.SH DESCRIPTION
+The \fBiadd()\fP function performs the operation of addition of integers located at addresses \fBa\fP and
+\fBb\fP, with the result placed at address \fBc\fP. The operands can be numbers with or without a sign.
+The memory contents at addresses \fBa\fP, \fBb\fP are not changed, the previous memory contents at address
+\fBc\fP are lost. The \fBnb\fP parameter defines the size in bytes of the operands located at addresses
+\fBc\fP, \fBa\fP, \fBb\fP.
+.PP
+The function affects the flags \fBA\fP, \fBC\fP, \fBO\fP, \fBP\fP, \fBS\fP, \fBZ\fP, and \fBV\fP.
+.PP
+Flags \fBА\fP and \fBP\fP are set only when the size of operands \fBa\fP, \fBb\fP is one or
+two bytes (\fBnb\fP == 1 || \fBnb\fP == 2).
+.sp
+.SH EXAMPLES
+.nf
+.sp
+#include <libmpu.h>
+#include <stdio.h>
+
+int main( void )
+{
+ int rc = 0;
+
+ __mpu_init();
+ __mpu_extra_warnings = 1;
+
+ {
+ mpu_int128_t c, a, b;
+ int nb = NB_I128;
+ __mpu_char8_t s[256];
+
+ iatoi( a, "237", nb ); /* evaluate the A variable */
+ iatoi( b, "37", nb ); /* evaluate the B variable */
+
+ iadd( c, a, b, nb );
+ iitoa( s, c, RADIX_DEC, LOWERCASE, nb ); /* convert C value to ASCII string S */
+ printf( "c = %s;\\n", s ); /* c = 274; */
+ }
+
+ __mpu_free_context();
+
+ return( rc );
+}
+.fi
+.sp
+.SH SEE ALSO
+.BR iadc (3),
+.BR isub (3),
+.BR isbb (3).
+