diff options
| author | Tyge Løvset <[email protected]> | 2023-07-07 17:21:22 +0200 |
|---|---|---|
| committer | Tyge Løvset <[email protected]> | 2023-07-07 17:21:22 +0200 |
| commit | 3a26c8fe4bce8a3af62042dd0fca5f36221359a9 (patch) | |
| tree | dfa0d899d8b28b4c0f04b66075dd41ceaea24732 /misc/examples | |
| parent | d8c1a999cc566b8943003ad5281abc6eefcda519 (diff) | |
| download | STC-modified-3a26c8fe4bce8a3af62042dd0fca5f36221359a9.tar.gz STC-modified-3a26c8fe4bce8a3af62042dd0fca5f36221359a9.zip | |
Issue #62: Fixed wrong printf format specifiers. Changed cbits.h to use long long (guaranteed at least 64-bit) instead of int64_t for easier print.
Second part of #62 is due to a clang compiler bug, can be avoided by using c_foreach instead of c_forpair.
Diffstat (limited to 'misc/examples')
| -rw-r--r-- | misc/examples/bits.c | 12 | ||||
| -rw-r--r-- | misc/examples/bits2.c | 4 |
2 files changed, 8 insertions, 8 deletions
diff --git a/misc/examples/bits.c b/misc/examples/bits.c index 95452300..ce8e1de4 100644 --- a/misc/examples/bits.c +++ b/misc/examples/bits.c @@ -10,18 +10,18 @@ int main(void) cbits_drop(&set), cbits_drop(&s2) ){ - printf("count %" c_ZI ", %" c_ZI "\n", cbits_count(&set), cbits_size(&set)); + printf("count %lld, %lld\n", cbits_count(&set), cbits_size(&set)); cbits s1 = cbits_from("1110100110111"); char buf[256]; cbits_to_str(&s1, buf, 0, 255); - printf("buf: %s: %" c_ZI "\n", buf, cbits_count(&s1)); + printf("buf: %s: %lld\n", buf, cbits_count(&s1)); cbits_drop(&s1); cbits_reset(&set, 9); cbits_resize(&set, 43, false); printf(" str: %s\n", cbits_to_str(&set, buf, 0, 255)); - printf("%4" c_ZI ": ", cbits_size(&set)); + printf("%4lld: ", cbits_size(&set)); c_forrange (i, cbits_size(&set)) printf("%d", cbits_test(&set, i)); puts(""); @@ -31,12 +31,12 @@ int main(void) cbits_resize(&set, 93, false); cbits_resize(&set, 102, true); cbits_set_value(&set, 99, false); - printf("%4" c_ZI ": ", cbits_size(&set)); + printf("%4lld: ", cbits_size(&set)); c_forrange (i, cbits_size(&set)) printf("%d", cbits_test(&set, i)); puts("\nIterate:"); - printf("%4" c_ZI ": ", cbits_size(&set)); + printf("%4lld: ", cbits_size(&set)); c_forrange (i, cbits_size(&set)) printf("%d", cbits_test(&set, i)); puts(""); @@ -59,7 +59,7 @@ int main(void) puts(""); cbits_set_all(&set, false); - printf("%4" c_ZI ": ", cbits_size(&set)); + printf("%4lld: ", cbits_size(&set)); c_forrange (i, cbits_size(&set)) printf("%d", cbits_test(&set, i)); puts(""); diff --git a/misc/examples/bits2.c b/misc/examples/bits2.c index b002af3c..913bd185 100644 --- a/misc/examples/bits2.c +++ b/misc/examples/bits2.c @@ -9,10 +9,10 @@ int main() { Bits s1 = Bits_from("1110100110111"); - printf("size %" c_ZI "\n", Bits_size(&s1)); + printf("size %lld\n", Bits_size(&s1)); char buf[256]; Bits_to_str(&s1, buf, 0, 256); - printf("buf: %s: count=%" c_ZI "\n", buf, Bits_count(&s1)); + printf("buf: %s: count=%lld\n", buf, Bits_count(&s1)); Bits_reset(&s1, 8); printf(" s1: %s\n", Bits_to_str(&s1, buf, 0, 256)); |
