My Project
Loading...
Searching...
No Matches
az_atoi.c
Go to the documentation of this file.
1// kernel_lib_printf_functions
2/*
3 * Kernel Lib Printf Functions
4 *
5 * Maintainer: Park Jiwoo
6 *
7 * Copyright (C) 2024 Park-Jiwoo
8 *
9 */
10#include "kernel_pr_he.h"
11
12int az_atoi(const char *s)
13{
14 int i;
15 int conv;
16 int res;
17 int neg_chk;
18
19 i = 0;
20 conv = 0;
21
22 neg_chk = 1;
23
24 if (s == NULL)
25 return (0);
26
27 if (s[i] == '-')
28 {
29 neg_chk = -1;
30 i++;
31 }
32 else if (s[i] == '+')
33 i++;
34
35 while (s[i] >= 48 && s[i] <= 57)
36 {
37 conv = conv * 10 + s[i++] - 48;
38 }
39 res = conv * neg_chk;
40 return (res);
41}
int az_atoi(const char *s)
Definition az_atoi.c:12