diff options
| author | Martial Simon <msimon_fr@hotmail.com> | 2025-10-11 22:19:00 +0200 |
|---|---|---|
| committer | Martial Simon <msimon_fr@hotmail.com> | 2025-10-11 22:19:00 +0200 |
| commit | 73c2b00a10c5786ddeeacc915e233fd4df1c9321 (patch) | |
| tree | e299ea4e8ac161b2b21170172ff8f182c1c3fe1a /rushs/tinyprintf/my_itoa_base | |
| parent | c9b6b9a5ca082fe7c1b6f58d7713f785a9eb6a5c (diff) | |
fix: evalexpr & tinyprintf contenaient toute la piscine
Diffstat (limited to 'rushs/tinyprintf/my_itoa_base')
| -rw-r--r-- | rushs/tinyprintf/my_itoa_base/my_itoa_base.c | 49 | ||||
| -rw-r--r-- | rushs/tinyprintf/my_itoa_base/my_itoa_base.h | 6 |
2 files changed, 0 insertions, 55 deletions
diff --git a/rushs/tinyprintf/my_itoa_base/my_itoa_base.c b/rushs/tinyprintf/my_itoa_base/my_itoa_base.c deleted file mode 100644 index 29b3042..0000000 --- a/rushs/tinyprintf/my_itoa_base/my_itoa_base.c +++ /dev/null @@ -1,49 +0,0 @@ -#include "my_itoa_base.h" - -int base_count(const char *base) -{ - int i; - for (i = 0; base[i]; i++) - { - continue; - } - return i; -} - -char *my_itoa_base(int n, char *s, const char *base) -{ - if (n == 0) - { - s[0] = base[0]; - s[1] = '\0'; - return s; - } - char *head = s; - if (n < 0) - { - s[0] = '-'; - s++; - n = -n; - } - - // count numbers - int t = n; - int m = 0; - int b = base_count(base); - while (t > 0) - { - t /= b; - m++; - } - - // n = number count - s[m] = '\0'; - m--; - for (; m >= 0; m--) - { - s[m] = base[n % b]; - n /= b; - } - - return head; -} diff --git a/rushs/tinyprintf/my_itoa_base/my_itoa_base.h b/rushs/tinyprintf/my_itoa_base/my_itoa_base.h deleted file mode 100644 index 0be6314..0000000 --- a/rushs/tinyprintf/my_itoa_base/my_itoa_base.h +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef MY_ITOA_BASE_H -#define MY_ITOA_BASE_H - -char *my_itoa_base(int n, char *s, const char *base); - -#endif /* ! MY_ITOA_BASE_H */ |
