aboutsummaryrefslogtreecommitdiffstats
path: root/libj2_j2u_to_j2i.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_j2u_to_j2i.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 'libj2_j2u_to_j2i.c')
-rw-r--r--libj2_j2u_to_j2i.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/libj2_j2u_to_j2i.c b/libj2_j2u_to_j2i.c
index eb5b404..f157b79 100644
--- a/libj2_j2u_to_j2i.c
+++ b/libj2_j2u_to_j2i.c
@@ -74,6 +74,15 @@ main(void)
EXPECT(u.low == b);
}
+ v = (struct libj2_j2i){111, 222};
+ u.high = a = 100;
+ u.low = b = 200;
+ libj2_j2u_rsub_ju(&u, 0);
+ libj2_j2u_to_j2i(&u, &v);
+ libj2_minus_j2i(&v);
+ EXPECT(v.high == a);
+ EXPECT(v.low == b);
+
return 0;
}