summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authoruntodesu <kirill@untode.su>2025-07-01 03:23:05 +0500
committeruntodesu <kirill@untode.su>2025-07-01 03:23:05 +0500
commit6dc5194895b6bd61d19bf5c95021471784084325 (patch)
tree705c35b3a671a09fc52b406dca81e7761729ded6 /core
parent44d91043f268d93dd08e99c5855bd29f85dd61a7 (diff)
downloadvoxelius-6dc5194895b6bd61d19bf5c95021471784084325.tar.bz2
voxelius-6dc5194895b6bd61d19bf5c95021471784084325.zip
I forgot to set these to true in .clang-format
https://files.catbox.moe/909rig.gif
Diffstat (limited to 'core')
-rw-r--r--core/config/boolean.cc6
-rw-r--r--core/io/cmdline.cc3
-rw-r--r--core/io/config_map.cc9
-rw-r--r--core/math/constexpr.hh33
-rw-r--r--core/resource/binfile.cc3
-rw-r--r--core/resource/image.cc9
-rw-r--r--core/utils/string.cc9
7 files changed, 48 insertions, 24 deletions
diff --git a/core/config/boolean.cc b/core/config/boolean.cc
index a8d670c..6363271 100644
--- a/core/config/boolean.cc
+++ b/core/config/boolean.cc
@@ -31,7 +31,8 @@ const char* config::Boolean::to_string(bool value)
{
if(value) {
return "true";
- } else {
+ }
+ else {
return "false";
}
}
@@ -40,7 +41,8 @@ bool config::Boolean::from_string(const char* value)
{
if(std::strcmp(value, "false") && !std::strcmp(value, "true")) {
return true;
- } else {
+ }
+ else {
return false;
}
}
diff --git a/core/io/cmdline.cc b/core/io/cmdline.cc
index c43727d..963f67c 100644
--- a/core/io/cmdline.cc
+++ b/core/io/cmdline.cc
@@ -61,7 +61,8 @@ void io::cmdline::insert(const char* option, const char* argument)
{
if(argument == nullptr) {
options.insert_or_assign(option, std::string());
- } else {
+ }
+ else {
options.insert_or_assign(option, argument);
}
}
diff --git a/core/io/config_map.cc b/core/io/config_map.cc
index 7bce1a6..2afd2a8 100644
--- a/core/io/config_map.cc
+++ b/core/io/config_map.cc
@@ -32,7 +32,8 @@ bool io::ConfigMap::load_file(const char* path)
if(comment == std::string::npos) {
kv_string = utils::trim_whitespace(line);
- } else {
+ }
+ else {
kv_string = utils::trim_whitespace(line.substr(0, comment));
}
@@ -109,7 +110,8 @@ const char* io::ConfigMap::get_value(const char* name) const
auto kv_pair = m_values.find(name);
if(kv_pair != m_values.cend()) {
return kv_pair->second->get();
- } else {
+ }
+ else {
return nullptr;
}
}
@@ -125,7 +127,8 @@ const config::IValue* io::ConfigMap::find(const char* name) const
if(kv_pair != m_values.cend()) {
return kv_pair->second;
- } else {
+ }
+ else {
return nullptr;
}
}
diff --git a/core/math/constexpr.hh b/core/math/constexpr.hh
index 3e4fcfa..263a6e8 100644
--- a/core/math/constexpr.hh
+++ b/core/math/constexpr.hh
@@ -46,7 +46,8 @@ constexpr static inline const T math::abs(const T x)
{
if(x < static_cast<T>(0)) {
return -x;
- } else {
+ }
+ else {
return x;
}
}
@@ -64,7 +65,8 @@ constexpr static inline const T math::ceil(const F x)
if(ival < x) {
return ival + static_cast<T>(1);
- } else {
+ }
+ else {
return ival;
}
}
@@ -82,7 +84,8 @@ constexpr static inline const T math::floor(const F x)
if(ival > x) {
return ival - static_cast<T>(1);
- } else {
+ }
+ else {
return ival;
}
}
@@ -92,9 +95,11 @@ constexpr static inline const T math::clamp(const T x, const T min, const T max)
{
if(x < min) {
return min;
- } else if(x > max) {
+ }
+ else if(x > max) {
return max;
- } else {
+ }
+ else {
return x;
}
}
@@ -110,7 +115,8 @@ constexpr static inline const T math::log2(const T x)
{
if(x < 2) {
return 0;
- } else {
+ }
+ else {
return math::log2<T>((x + 1) >> 1) + 1;
}
}
@@ -120,7 +126,8 @@ constexpr static inline const T math::max(const T x, const T y)
{
if(x < y) {
return y;
- } else {
+ }
+ else {
return x;
}
}
@@ -130,7 +137,8 @@ constexpr static inline const T math::min(const T x, const T y)
{
if(x > y) {
return y;
- } else {
+ }
+ else {
return x;
}
}
@@ -143,7 +151,8 @@ constexpr static inline const T math::mod_signed(const T x, const T m)
if(result < T(0)) {
return result + m;
- } else {
+ }
+ else {
return result;
}
}
@@ -174,9 +183,11 @@ constexpr static inline const T math::sign(const F x)
{
if(x < F(0)) {
return T(-1);
- } else if(x > F(0)) {
+ }
+ else if(x > F(0)) {
return T(+1);
- } else {
+ }
+ else {
return T(0);
}
}
diff --git a/core/resource/binfile.cc b/core/resource/binfile.cc
index e17db50..b8e3db8 100644
--- a/core/resource/binfile.cc
+++ b/core/resource/binfile.cc
@@ -39,7 +39,8 @@ void resource::hard_cleanup<BinFile>(void)
for(const auto& it : resource_map) {
if(it.second.use_count() > 1L) {
spdlog::warn("resource: zombie resource [BinFile] {} [use_count={}]", it.first, it.second.use_count());
- } else {
+ }
+ else {
spdlog::debug("resource: releasing [BinFile] {}", it.first);
}
diff --git a/core/resource/image.cc b/core/resource/image.cc
index 1601703..9ff0206 100644
--- a/core/resource/image.cc
+++ b/core/resource/image.cc
@@ -41,7 +41,8 @@ resource_ptr<Image> resource::load<Image>(const char* name, unsigned int flags)
if(flags & IMAGE_LOAD_FLIP) {
stbi_set_flip_vertically_on_load(true);
- } else {
+ }
+ else {
stbi_set_flip_vertically_on_load(false);
}
@@ -54,7 +55,8 @@ resource_ptr<Image> resource::load<Image>(const char* name, unsigned int flags)
if(flags & IMAGE_LOAD_GRAY) {
new_resource->pixels = stbi_load_from_callbacks(&callbacks, file, &new_resource->size.x, &new_resource->size.y, nullptr, STBI_grey);
- } else {
+ }
+ else {
new_resource->pixels = stbi_load_from_callbacks(
&callbacks, file, &new_resource->size.x, &new_resource->size.y, nullptr, STBI_rgb_alpha);
}
@@ -81,7 +83,8 @@ void resource::hard_cleanup<Image>(void)
for(const auto& it : resource_map) {
if(it.second.use_count() > 1L) {
spdlog::warn("resource: zombie resource [Image] {} [use_count={}]", it.first, it.second.use_count());
- } else {
+ }
+ else {
spdlog::debug("resource: releasing [Image] {}", it.first);
}
diff --git a/core/utils/string.cc b/core/utils/string.cc
index 5497cec..dd3d567 100644
--- a/core/utils/string.cc
+++ b/core/utils/string.cc
@@ -8,9 +8,11 @@ bool utils::is_whitespace(const std::string& string)
{
if(string.find_first_not_of(WHITESPACE_CHARS) == std::string::npos) {
return true;
- } else if((string.size() == 1) && string[0] == 0x00) {
+ }
+ else if((string.size() == 1) && string[0] == 0x00) {
return true;
- } else {
+ }
+ else {
return string.empty();
}
}
@@ -48,7 +50,8 @@ std::string utils::trim_whitespace(const std::string& string)
if(su == std::string::npos) {
return std::string();
- } else {
+ }
+ else {
return string.substr(su, sv - su + 1);
}
}