summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2021-04-02 08:04:54 +0200
committerbunnei <bunneidev@gmail.com>2021-05-06 01:40:49 +0200
commit02c2b28cd0f341fd955f9648d9174777e0b60689 (patch)
tree1e9ce7f349b8cf14d0537ecb952da0435227515c
parenthle: kernel: Add initial impl. of KLinkedList. (diff)
downloadyuzu-02c2b28cd0f341fd955f9648d9174777e0b60689.tar
yuzu-02c2b28cd0f341fd955f9648d9174777e0b60689.tar.gz
yuzu-02c2b28cd0f341fd955f9648d9174777e0b60689.tar.bz2
yuzu-02c2b28cd0f341fd955f9648d9174777e0b60689.tar.lz
yuzu-02c2b28cd0f341fd955f9648d9174777e0b60689.tar.xz
yuzu-02c2b28cd0f341fd955f9648d9174777e0b60689.tar.zst
yuzu-02c2b28cd0f341fd955f9648d9174777e0b60689.zip
-rw-r--r--src/common/common_funcs.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/common/common_funcs.h b/src/common/common_funcs.h
index 73c8c9354..19bb021e0 100644
--- a/src/common/common_funcs.h
+++ b/src/common/common_funcs.h
@@ -136,4 +136,19 @@ namespace Common {
return u32(a) | u32(b) << 8 | u32(c) << 16 | u32(d) << 24;
}
+// std::size() does not support zero-size C arrays. We're fixing that.
+template <class C>
+constexpr auto Size(const C& c) -> decltype(c.size()) {
+ return std::size(c);
+}
+
+template <class C>
+constexpr std::size_t Size(const C& c) {
+ if constexpr (sizeof(C) == 0) {
+ return 0;
+ } else {
+ return std::size(c);
+ }
+}
+
} // namespace Common