util/WCharUtil: remove redundant inline
keywords from constexpr
functions
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2011-2017 Max Kellermann <max.kellermann@gmail.com>
|
* Copyright 2011-2019 Max Kellermann <max.kellermann@gmail.com>
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions
|
* modification, are permitted provided that the following conditions
|
||||||
@@ -32,22 +32,19 @@
|
|||||||
|
|
||||||
#include <wchar.h>
|
#include <wchar.h>
|
||||||
|
|
||||||
constexpr
|
constexpr bool
|
||||||
static inline bool
|
|
||||||
IsASCII(const wchar_t ch)
|
IsASCII(const wchar_t ch)
|
||||||
{
|
{
|
||||||
return (ch & ~0x7f) == 0;
|
return (ch & ~0x7f) == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
constexpr
|
constexpr bool
|
||||||
static inline bool
|
|
||||||
IsWhitespaceOrNull(const wchar_t ch)
|
IsWhitespaceOrNull(const wchar_t ch)
|
||||||
{
|
{
|
||||||
return (unsigned)ch <= 0x20;
|
return (unsigned)ch <= 0x20;
|
||||||
}
|
}
|
||||||
|
|
||||||
constexpr
|
constexpr bool
|
||||||
static inline bool
|
|
||||||
IsWhitespaceNotNull(const wchar_t ch)
|
IsWhitespaceNotNull(const wchar_t ch)
|
||||||
{
|
{
|
||||||
return ch > 0 && ch <= 0x20;
|
return ch > 0 && ch <= 0x20;
|
||||||
@@ -59,50 +56,43 @@ IsWhitespaceNotNull(const wchar_t ch)
|
|||||||
* want the fastest implementation, and you don't care if a null byte
|
* want the fastest implementation, and you don't care if a null byte
|
||||||
* matches.
|
* matches.
|
||||||
*/
|
*/
|
||||||
constexpr
|
constexpr bool
|
||||||
static inline bool
|
|
||||||
IsWhitespaceFast(const wchar_t ch)
|
IsWhitespaceFast(const wchar_t ch)
|
||||||
{
|
{
|
||||||
return IsWhitespaceOrNull(ch);
|
return IsWhitespaceOrNull(ch);
|
||||||
}
|
}
|
||||||
|
|
||||||
constexpr
|
constexpr bool
|
||||||
static inline bool
|
|
||||||
IsPrintableASCII(wchar_t ch)
|
IsPrintableASCII(wchar_t ch)
|
||||||
{
|
{
|
||||||
return IsASCII(ch) && ch >= 0x20;
|
return IsASCII(ch) && ch >= 0x20;
|
||||||
}
|
}
|
||||||
|
|
||||||
constexpr
|
constexpr bool
|
||||||
static inline bool
|
|
||||||
IsDigitASCII(wchar_t ch)
|
IsDigitASCII(wchar_t ch)
|
||||||
{
|
{
|
||||||
return ch >= '0' && ch <= '9';
|
return ch >= '0' && ch <= '9';
|
||||||
}
|
}
|
||||||
|
|
||||||
constexpr
|
constexpr bool
|
||||||
static inline bool
|
|
||||||
IsUpperAlphaASCII(wchar_t ch)
|
IsUpperAlphaASCII(wchar_t ch)
|
||||||
{
|
{
|
||||||
return ch >= 'A' && ch <= 'Z';
|
return ch >= 'A' && ch <= 'Z';
|
||||||
}
|
}
|
||||||
|
|
||||||
constexpr
|
constexpr bool
|
||||||
static inline bool
|
|
||||||
IsLowerAlphaASCII(wchar_t ch)
|
IsLowerAlphaASCII(wchar_t ch)
|
||||||
{
|
{
|
||||||
return ch >= 'a' && ch <= 'z';
|
return ch >= 'a' && ch <= 'z';
|
||||||
}
|
}
|
||||||
|
|
||||||
constexpr
|
constexpr bool
|
||||||
static inline bool
|
|
||||||
IsAlphaASCII(wchar_t ch)
|
IsAlphaASCII(wchar_t ch)
|
||||||
{
|
{
|
||||||
return IsUpperAlphaASCII(ch) || IsLowerAlphaASCII(ch);
|
return IsUpperAlphaASCII(ch) || IsLowerAlphaASCII(ch);
|
||||||
}
|
}
|
||||||
|
|
||||||
constexpr
|
constexpr bool
|
||||||
static inline bool
|
|
||||||
IsAlphaNumericASCII(wchar_t ch)
|
IsAlphaNumericASCII(wchar_t ch)
|
||||||
{
|
{
|
||||||
return IsAlphaASCII(ch) || IsDigitASCII(ch);
|
return IsAlphaASCII(ch) || IsDigitASCII(ch);
|
||||||
@@ -112,8 +102,7 @@ IsAlphaNumericASCII(wchar_t ch)
|
|||||||
* Convert the specified ASCII character (0x00..0x7f) to upper case.
|
* Convert the specified ASCII character (0x00..0x7f) to upper case.
|
||||||
* Unlike toupper(), it ignores the system locale.
|
* Unlike toupper(), it ignores the system locale.
|
||||||
*/
|
*/
|
||||||
constexpr
|
constexpr wchar_t
|
||||||
static inline wchar_t
|
|
||||||
ToUpperASCII(wchar_t ch)
|
ToUpperASCII(wchar_t ch)
|
||||||
{
|
{
|
||||||
return ch >= 'a' && ch <= 'z'
|
return ch >= 'a' && ch <= 'z'
|
||||||
@@ -125,8 +114,7 @@ ToUpperASCII(wchar_t ch)
|
|||||||
* Convert the specified ASCII character (0x00..0x7f) to lower case.
|
* Convert the specified ASCII character (0x00..0x7f) to lower case.
|
||||||
* Unlike tolower(), it ignores the system locale.
|
* Unlike tolower(), it ignores the system locale.
|
||||||
*/
|
*/
|
||||||
constexpr
|
constexpr wchar_t
|
||||||
static inline wchar_t
|
|
||||||
ToLowerASCII(wchar_t ch)
|
ToLowerASCII(wchar_t ch)
|
||||||
{
|
{
|
||||||
return ch >= 'A' && ch <= 'Z'
|
return ch >= 'A' && ch <= 'Z'
|
||||||
|
Reference in New Issue
Block a user