Compare commits
2 Commits
109de54822
...
1b3243a80c
Author | SHA1 | Date | |
---|---|---|---|
1b3243a80c | |||
762ca844d8 |
@ -6,6 +6,8 @@ struct Registers;
|
||||
namespace CPU
|
||||
{
|
||||
Result<const char*> identify();
|
||||
const char* platform_string();
|
||||
|
||||
void platform_init();
|
||||
|
||||
[[noreturn]] void efficient_halt();
|
||||
|
@ -296,6 +296,11 @@ namespace CPU
|
||||
return brand_string;
|
||||
}
|
||||
|
||||
const char* platform_string()
|
||||
{
|
||||
return "x86_64";
|
||||
}
|
||||
|
||||
void platform_init()
|
||||
{
|
||||
enable_sse();
|
||||
|
78
luna/CType.h
Normal file
78
luna/CType.h
Normal file
@ -0,0 +1,78 @@
|
||||
#pragma once
|
||||
|
||||
inline constexpr int _isascii(int c)
|
||||
{
|
||||
return !(c & ~0x7f);
|
||||
}
|
||||
|
||||
inline constexpr int _isblank(int c)
|
||||
{
|
||||
return c == ' ' || c == '\t';
|
||||
}
|
||||
|
||||
inline constexpr int _iscntrl(int c)
|
||||
{
|
||||
return (unsigned int)c < 0x20 || c == 0x7f;
|
||||
}
|
||||
|
||||
inline constexpr int _isdigit(int c)
|
||||
{
|
||||
return c >= '0' && c < ':';
|
||||
}
|
||||
|
||||
inline constexpr int _isgraph(int c)
|
||||
{
|
||||
return (unsigned int)c - 0x21 < 0x5e;
|
||||
}
|
||||
|
||||
inline constexpr int _islower(int c)
|
||||
{
|
||||
return c >= 'a' && c < '{';
|
||||
}
|
||||
|
||||
inline constexpr int _isupper(int c)
|
||||
{
|
||||
return c >= 'A' && c < '[';
|
||||
}
|
||||
|
||||
inline constexpr int _isprint(int c)
|
||||
{
|
||||
return (unsigned int)c - 0x20 < 0x5f;
|
||||
}
|
||||
|
||||
inline constexpr int _isalpha(int c)
|
||||
{
|
||||
return _islower(c) || _isupper(c);
|
||||
}
|
||||
|
||||
inline constexpr int _isalnum(int c)
|
||||
{
|
||||
return _isalpha(c) || _isdigit(c);
|
||||
}
|
||||
|
||||
inline constexpr int _ispunct(int c)
|
||||
{
|
||||
return _isgraph(c) && !_isalnum(c);
|
||||
}
|
||||
|
||||
inline constexpr int _isspace(int c)
|
||||
{
|
||||
return c == ' ' || (unsigned int)c - '\t' < 5;
|
||||
}
|
||||
|
||||
inline constexpr int _isxdigit(int c)
|
||||
{
|
||||
return _isdigit(c) || ((unsigned int)c | 32) - 'a' < 6;
|
||||
}
|
||||
|
||||
inline constexpr int _tolower(int c)
|
||||
{
|
||||
if (_isupper(c)) return c | 32;
|
||||
return c;
|
||||
}
|
||||
|
||||
inline constexpr int _toupper(int c)
|
||||
{
|
||||
if (_islower(c)) return c & 0x5f;
|
||||
return c;
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user