diff options
| author | Mattias Andrée <m@maandree.se> | 2025-12-11 18:32:27 +0100 |
|---|---|---|
| committer | Mattias Andrée <m@maandree.se> | 2025-12-11 18:32:27 +0100 |
| commit | 50bb696a6b4d75a097f22274834f67961fa9e440 (patch) | |
| tree | 44270d52d6440c02b30b4b7d49950519770585c2 /libj2_min_j2u.c | |
| parent | cleanup (diff) | |
| download | libj2-50bb696a6b4d75a097f22274834f67961fa9e440.tar.gz libj2-50bb696a6b4d75a097f22274834f67961fa9e440.tar.bz2 libj2-50bb696a6b4d75a097f22274834f67961fa9e440.tar.xz | |
Add signed integers (arithmetics and some testing not implemented yet)
Signed-off-by: Mattias Andrée <m@maandree.se>
Diffstat (limited to 'libj2_min_j2u.c')
| -rw-r--r-- | libj2_min_j2u.c | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/libj2_min_j2u.c b/libj2_min_j2u.c index 729bbfd..d74359a 100644 --- a/libj2_min_j2u.c +++ b/libj2_min_j2u.c @@ -10,6 +10,7 @@ extern inline void libj2_min_j2u(struct libj2_j2u *a, ... /*, NULL */); static struct libj2_j2u v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13; + static void reset(void) { @@ -17,18 +18,19 @@ reset(void) v1 = (struct libj2_j2u){0, 0}; v2 = (struct libj2_j2u){0, 1}; v3 = (struct libj2_j2u){0, 2}; - v4 = (struct libj2_j2u){0, max - 1}; + v4 = (struct libj2_j2u){0, max - 1U}; v5 = (struct libj2_j2u){1, 0}; v6 = (struct libj2_j2u){1, 1}; - v7 = (struct libj2_j2u){max - 1, 0}; - v8 = (struct libj2_j2u){max - 1, 1}; - v9 = (struct libj2_j2u){max - 1, max}; + v7 = (struct libj2_j2u){max - 1U, 0}; + v8 = (struct libj2_j2u){max - 1U, 1}; + v9 = (struct libj2_j2u){max - 1U, max}; v10 = (struct libj2_j2u){max, 0}; v11 = (struct libj2_j2u){max, 1}; - v12 = (struct libj2_j2u){max, max - 1}; + v12 = (struct libj2_j2u){max, max - 1U}; v13 = (struct libj2_j2u){max, max}; } + static void expect_untouched(void) { @@ -36,18 +38,19 @@ expect_untouched(void) EXPECT(libj2_j2u_eq_j2u(&v1, &(struct libj2_j2u){0, 0}) == 1); EXPECT(libj2_j2u_eq_j2u(&v2, &(struct libj2_j2u){0, 1}) == 1); EXPECT(libj2_j2u_eq_j2u(&v3, &(struct libj2_j2u){0, 2}) == 1); - EXPECT(libj2_j2u_eq_j2u(&v4, &(struct libj2_j2u){0, max - 1}) == 1); + EXPECT(libj2_j2u_eq_j2u(&v4, &(struct libj2_j2u){0, max - 1U}) == 1); EXPECT(libj2_j2u_eq_j2u(&v5, &(struct libj2_j2u){1, 0}) == 1); EXPECT(libj2_j2u_eq_j2u(&v6, &(struct libj2_j2u){1, 1}) == 1); - EXPECT(libj2_j2u_eq_j2u(&v7, &(struct libj2_j2u){max - 1, 0}) == 1); - EXPECT(libj2_j2u_eq_j2u(&v8, &(struct libj2_j2u){max - 1, 1}) == 1); - EXPECT(libj2_j2u_eq_j2u(&v9, &(struct libj2_j2u){max - 1, max}) == 1); + EXPECT(libj2_j2u_eq_j2u(&v7, &(struct libj2_j2u){max - 1U, 0}) == 1); + EXPECT(libj2_j2u_eq_j2u(&v8, &(struct libj2_j2u){max - 1U, 1}) == 1); + EXPECT(libj2_j2u_eq_j2u(&v9, &(struct libj2_j2u){max - 1U, max}) == 1); EXPECT(libj2_j2u_eq_j2u(&v10, &(struct libj2_j2u){max, 0}) == 1); EXPECT(libj2_j2u_eq_j2u(&v11, &(struct libj2_j2u){max, 1}) == 1); - EXPECT(libj2_j2u_eq_j2u(&v12, &(struct libj2_j2u){max, max - 1}) == 1); + EXPECT(libj2_j2u_eq_j2u(&v12, &(struct libj2_j2u){max, max - 1U}) == 1); EXPECT(libj2_j2u_eq_j2u(&v13, &(struct libj2_j2u){max, max}) == 1); } + #define HEAD(X, ...) X #define TAIL(X, ...) __VA_ARGS__ @@ -71,6 +74,7 @@ expect_untouched(void) EXPECT(libj2_j2u_eq_j2u(&(MIN), &r));\ } while (0) + int main(void) { |
