You've already forked hardkernel-uboot
mirror of
https://github.com/archr-linux/hardkernel-uboot.git
synced 2026-03-31 15:05:07 -07:00
Since we need to realize standard library function other than use them with gcc tool chain in U-Boot. So add standard library function here. Change-Id: I10009c5bbe31fabacd929df3c44218ae9c6a885f Signed-off-by: Jason Zhu <jason.zhu@rock-chips.com>
40 lines
604 B
C
40 lines
604 B
C
// SPDX-License-Identifier: GPL-2.0
|
|
/*
|
|
* Copyright (c) 2019 Fuzhou Rockchip Electronics Co., Ltd
|
|
*/
|
|
|
|
#include <linux/ctype.h>
|
|
#include <linux/types.h>
|
|
|
|
long atol(const char *nptr)
|
|
{
|
|
int c;
|
|
long total;
|
|
int sign;
|
|
|
|
while (isspace((int)(unsigned char)*nptr))
|
|
++nptr;
|
|
|
|
c = (int)(unsigned char)*nptr++;
|
|
sign = c;
|
|
if (c == '-' || c == '+')
|
|
c = (int)(unsigned char)*nptr++;
|
|
|
|
total = 0;
|
|
|
|
while (isdigit(c)) {
|
|
total = 10 * total + (c - '0');
|
|
c = (int)(unsigned char)*nptr++;
|
|
}
|
|
|
|
if (sign == '-')
|
|
return -total;
|
|
else
|
|
return total;
|
|
}
|
|
|
|
int atoi(const char *nptr)
|
|
{
|
|
return (int)atol(nptr);
|
|
}
|