TianoCore EDK2 master
Loading...
Searching...
No Matches
fdt_strtoul.c
1#/* @file
2# Copyright (c) 2018, Linaro Limited. All rights reserved.
3#
4# SPDX-License-Identifier: BSD-2-Clause-Patent
5#
6#*/
7
8#include <Base.h>
9#include <Library/BaseLib.h>
10#include <Library/DebugLib.h>
11
12unsigned long
13strtoul (
14 const char *nptr,
15 char **endptr,
16 int base
17 )
18{
19 RETURN_STATUS Status;
20 UINTN ReturnValue;
21
22 ASSERT (base == 10 || base == 16);
23
24 if (base == 10) {
25 Status = AsciiStrDecimalToUintnS (nptr, endptr, &ReturnValue);
26 } else if (base == 16) {
27 Status = AsciiStrHexToUintnS (nptr, endptr, &ReturnValue);
28 } else {
30 }
31
32 if (RETURN_ERROR (Status)) {
33 return MAX_UINTN;
34 }
35
36 return ReturnValue;
37}
UINT64 UINTN
RETURN_STATUS EFIAPI AsciiStrDecimalToUintnS(IN CONST CHAR8 *String, OUT CHAR8 **EndPointer OPTIONAL, OUT UINTN *Data)
Definition: SafeString.c:2179
RETURN_STATUS EFIAPI AsciiStrHexToUintnS(IN CONST CHAR8 *String, OUT CHAR8 **EndPointer OPTIONAL, OUT UINTN *Data)
Definition: SafeString.c:2399
#define RETURN_ERROR(StatusCode)
Definition: Base.h:1061
#define RETURN_INVALID_PARAMETER
Definition: Base.h:1076