forked from OP-TEE/optee_os
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
libutils: isoc: implement tolower(), isdigit() and isxdigit()
Signed-off-by: Jerome Forissier <[email protected]> Reviewed-by: Jens Wiklander <[email protected]> Acked-by: Joakim Bech <[email protected]>
- Loading branch information
1 parent
fb30caf
commit d815ab4
Showing
4 changed files
with
45 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
// SPDX-License-Identifier: BSD-2-Clause | ||
/* | ||
* Copyright (c) 2018, Linaro Limited | ||
*/ | ||
#include <ctype.h> | ||
|
||
int __builtin_isdigit(int c) | ||
{ | ||
if (c >= '0' && c <= '9') | ||
return 1; | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// SPDX-License-Identifier: BSD-2-Clause | ||
/* | ||
* Copyright (c) 2018, Linaro Limited | ||
*/ | ||
#include <ctype.h> | ||
|
||
int __builtin_isxdigit(int c) | ||
{ | ||
if (isdigit(c)) | ||
return 1; | ||
if (c >= 'A' && c <= 'F') | ||
return 1; | ||
if (c >= 'a' && c <= 'f') | ||
return 1; | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
// SPDX-License-Identifier: BSD-2-Clause | ||
/* | ||
* Copyright (c) 2015, Linaro Limited | ||
*/ | ||
#include <ctype.h> | ||
|
||
int __builtin_tolower(int c) | ||
{ | ||
if (c >= 'A' && c <= 'Z') | ||
return c - 'A' + 'a'; | ||
return c; | ||
} |