mirror of
https://github.com/ipxe/ipxe
synced 2025-12-28 02:28:57 +03:00
Move tolower() etc to ctype.h as per ISO C
This commit is contained in:
28
src/include/ctype.h
Normal file
28
src/include/ctype.h
Normal file
@@ -0,0 +1,28 @@
|
||||
#ifndef _CTYPE_H
|
||||
#define _CTYPE_H
|
||||
|
||||
/** @file
|
||||
*
|
||||
* Character types
|
||||
*/
|
||||
|
||||
#define isdigit(c) ((c & 0x04) != 0)
|
||||
#define islower(c) ((c & 0x02) != 0)
|
||||
//#define isspace(c) ((c & 0x20) != 0)
|
||||
#define isupper(c) ((c & 0x01) != 0)
|
||||
|
||||
static inline unsigned char tolower(unsigned char c)
|
||||
{
|
||||
if (isupper(c))
|
||||
c -= 'A'-'a';
|
||||
return c;
|
||||
}
|
||||
|
||||
static inline unsigned char toupper(unsigned char c)
|
||||
{
|
||||
if (islower(c))
|
||||
c -= 'a'-'A';
|
||||
return c;
|
||||
}
|
||||
|
||||
#endif /* _CTYPE_H */
|
||||
Reference in New Issue
Block a user