Removed redundant if statements where possible
This commit is contained in:
@@ -27,11 +27,7 @@ namespace OpenVulkano
|
||||
|
||||
size_t SystemInfo::GetSystemRam()
|
||||
{
|
||||
static size_t ram;
|
||||
if (ram == 0)
|
||||
{
|
||||
ram = [NSProcessInfo processInfo].physicalMemory;
|
||||
}
|
||||
static const size_t ram = [NSProcessInfo processInfo].physicalMemory;
|
||||
return ram;
|
||||
}
|
||||
|
||||
@@ -75,21 +71,13 @@ namespace OpenVulkano
|
||||
|
||||
std::string SystemInfo::GetHostName()
|
||||
{
|
||||
static std::string hostName;
|
||||
if (hostName.empty())
|
||||
{
|
||||
hostName = [[NSProcessInfo processInfo].hostName UTF8String];
|
||||
}
|
||||
static const std::string hostName = [[NSProcessInfo processInfo].hostName UTF8String];
|
||||
return hostName;
|
||||
}
|
||||
|
||||
std::string SystemInfo::GetDeviceName()
|
||||
{
|
||||
static std::string devName;
|
||||
if (devName.empty())
|
||||
{
|
||||
devName = [[[UIDevice currentDevice] name] UTF8String];
|
||||
}
|
||||
static const std::string devName = [[[UIDevice currentDevice] name] UTF8String];
|
||||
return devName;
|
||||
}
|
||||
|
||||
@@ -113,17 +101,13 @@ namespace OpenVulkano
|
||||
|
||||
std::string SystemInfo::GetOsName()
|
||||
{
|
||||
static std::string osName;
|
||||
if (osName.empty())
|
||||
{
|
||||
osName = [[[UIDevice currentDevice] systemName] UTF8String];
|
||||
}
|
||||
static const std::string osName = [[[UIDevice currentDevice] systemName] UTF8String];
|
||||
return osName;
|
||||
}
|
||||
|
||||
OsVersion SystemInfo::GetOsVersion()
|
||||
{
|
||||
static OsVersion osv;
|
||||
static OsVersion osv = {};
|
||||
if (osv.major == 0 && osv.minor == 0)
|
||||
{
|
||||
NSOperatingSystemVersion osVersion = [NSProcessInfo processInfo].operatingSystemVersion;
|
||||
@@ -170,21 +154,13 @@ namespace OpenVulkano
|
||||
|
||||
size_t SystemInfo::GetCpuCoreCount()
|
||||
{
|
||||
static size_t coreCount;
|
||||
if (coreCount == 0)
|
||||
{
|
||||
coreCount = [NSProcessInfo processInfo].processorCount;
|
||||
}
|
||||
static const size_t coreCount = [NSProcessInfo processInfo].processorCount;
|
||||
return coreCount;
|
||||
}
|
||||
|
||||
size_t SystemInfo::GetCpuThreadCount()
|
||||
{
|
||||
static size_t threadCount;
|
||||
if (threadCount == 0)
|
||||
{
|
||||
threadCount = [NSProcessInfo processInfo].activeProcessorCount;
|
||||
}
|
||||
static const size_t threadCount = [NSProcessInfo processInfo].activeProcessorCount;
|
||||
return threadCount;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user