aboutsummaryrefslogtreecommitdiffstats
path: root/libj2_j2i_to_j2u.c
diff options
context:
space:
mode:
authorMattias Andrée <m@maandree.se>2026-01-21 16:54:08 +0100
committerMattias Andrée <m@maandree.se>2026-01-21 16:54:08 +0100
commitb282c2ae432841c882e6d4c9eec48f9d359e1364 (patch)
tree888dc29df75f7e3f0a4204863fea68b1d8e2f4fd /libj2_j2i_to_j2u.c
parentAdd some man pages (diff)
downloadlibj2-b282c2ae432841c882e6d4c9eec48f9d359e1364.tar.gz
libj2-b282c2ae432841c882e6d4c9eec48f9d359e1364.tar.bz2
libj2-b282c2ae432841c882e6d4c9eec48f9d359e1364.tar.xz
Document and add test for the result of converting between unsigned and negative
Signed-off-by: Mattias Andrée <m@maandree.se>
Diffstat (limited to '')
-rw-r--r--libj2_j2i_to_j2u.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/libj2_j2i_to_j2u.c b/libj2_j2i_to_j2u.c
index 4419c7a..b81c394 100644
--- a/libj2_j2i_to_j2u.c
+++ b/libj2_j2i_to_j2u.c
@@ -70,6 +70,15 @@ main(void)
EXPECT(u.low == b);
}
+ u = (struct libj2_j2u){111, 222};
+ v.high = a = 100;
+ v.low = b = 200;
+ libj2_minus_j2i(&v);
+ libj2_j2i_to_j2u(&v, &u);
+ libj2_j2u_rsub_ju(&u, 0);
+ EXPECT(u.high == a);
+ EXPECT(u.low == b);
+
return 0;
}