diff options
| author | nasr <nsrddyn@gmail.com> | 2026-03-13 22:31:21 +0100 |
|---|---|---|
| committer | nasr <nsrddyn@gmail.com> | 2026-03-13 22:31:21 +0100 |
| commit | 444bfa2f41143aff7490e4fa21565947565b7d30 (patch) | |
| tree | 696b06d40140c85805d171597e37deb8290ead73 /source/base/base_test.c | |
| parent | 3913d1778318cd0c6bfb871148d38abb33ec7fd3 (diff) | |
cleanup: generalisation
Diffstat (limited to 'source/base/base_test.c')
| -rw-r--r-- | source/base/base_test.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/source/base/base_test.c b/source/base/base_test.c new file mode 100644 index 0000000..e44aa69 --- /dev/null +++ b/source/base/base_test.c | |||
| @@ -0,0 +1,14 @@ | |||
| 1 | void | ||
| 2 | write_int(i32 num) | ||
| 3 | { | ||
| 4 | if (num < 0) | ||
| 5 | { | ||
| 6 | write(STDERR_FILENO, "-", 1); | ||
| 7 | num = -num; | ||
| 8 | } | ||
| 9 | if (num >= 10) | ||
| 10 | write_int(num / 10); | ||
| 11 | char digit = '0' + (num % 10); | ||
| 12 | |||
| 13 | write(STDERR_FILENO, &digit, 1); | ||
| 14 | } | ||
