Add util functions
This commit is contained in:
@@ -92,6 +92,20 @@ namespace openVulkanoCpp
|
|||||||
return log;
|
return log;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static constexpr int64_t OctToInt(std::string_view string)
|
||||||
|
{
|
||||||
|
int64_t result = 0;
|
||||||
|
for(int i = string.length() - 1; i >= 0; i--)
|
||||||
|
{
|
||||||
|
char c = string[i];
|
||||||
|
if (c == 0) break;
|
||||||
|
if (c == ' ') continue;
|
||||||
|
if (c < '0' || c > '7') return -1;
|
||||||
|
result = result * 8 + c - '0';
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
static bool IsLittleEndian()
|
static bool IsLittleEndian()
|
||||||
{ //TODO update with cpp20
|
{ //TODO update with cpp20
|
||||||
const int value { 0x01 };
|
const int value { 0x01 };
|
||||||
@@ -100,5 +114,15 @@ namespace openVulkanoCpp
|
|||||||
|
|
||||||
return (*least_significant_address == 0x01);
|
return (*least_significant_address == 0x01);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static constexpr bool StartsWith(std::string_view str, std::string_view prefix)
|
||||||
|
{
|
||||||
|
return str.size() >= prefix.size() && 0 == str.compare(0, prefix.size(), prefix);
|
||||||
|
}
|
||||||
|
|
||||||
|
static constexpr bool EndsWith(std::string_view str, std::string_view suffix)
|
||||||
|
{
|
||||||
|
return str.size() >= suffix.size() && 0 == str.compare(str.size()-suffix.size(), suffix.size(), suffix);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ namespace openVulkanoCpp
|
|||||||
}
|
}
|
||||||
|
|
||||||
Array(Array<T>&& other) noexcept:
|
Array(Array<T>&& other) noexcept:
|
||||||
size(other.size()), data(other.data())
|
size(other.size), data(other.data)
|
||||||
{
|
{
|
||||||
other.data = nullptr;
|
other.data = nullptr;
|
||||||
other.size = 0;
|
other.size = 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user