diff options
author | Freya Murphy <freya@freyacat.org> | 2025-04-08 10:39:48 -0400 |
---|---|---|
committer | Freya Murphy <freya@freyacat.org> | 2025-04-08 10:39:48 -0400 |
commit | 8a19547957a86bed3f58c9abc1ac218d04698faf (patch) | |
tree | ed7ccc6f3a8902915dfe6c9bf763fc45d752b3c4 /kernel/lib/ctoi.c | |
parent | fmt (diff) | |
download | comus-8a19547957a86bed3f58c9abc1ac218d04698faf.tar.gz comus-8a19547957a86bed3f58c9abc1ac218d04698faf.tar.bz2 comus-8a19547957a86bed3f58c9abc1ac218d04698faf.zip |
break apart c libaray
Diffstat (limited to 'kernel/lib/ctoi.c')
-rw-r--r-- | kernel/lib/ctoi.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/kernel/lib/ctoi.c b/kernel/lib/ctoi.c new file mode 100644 index 0000000..09a9f10 --- /dev/null +++ b/kernel/lib/ctoi.c @@ -0,0 +1,14 @@ +#include <lib.h> + +int ctoi(char c) +{ + if (c >= '0' && c <= '9') { + return c - '0'; + } else if (c >= 'A' && c <= 'Z') { + return c - 'A' + 10; + } else if (c >= 'a' && c <= 'z') { + return c - 'a' + 10; + } else { + return -1; + } +} |