aboutsummaryrefslogtreecommitdiff
path: root/src/zencore/memoryview.cpp
diff options
context:
space:
mode:
authorStefan Boberg <[email protected]>2024-11-25 10:26:59 +0100
committerGitHub Enterprise <[email protected]>2024-11-25 10:26:59 +0100
commit1e43506a365c91e411c2375ec55a7d5ad918df0e (patch)
treeacfb1ff64f6f8b038b75129379d50eecd4f2301c /src/zencore/memoryview.cpp
parentInsights-compatible memory tracking (#214) (diff)
downloadzen-1e43506a365c91e411c2375ec55a7d5ad918df0e.tar.xz
zen-1e43506a365c91e411c2375ec55a7d5ad918df0e.zip
split zencore/memory.h -> memoryview.h, memcmp.h (#228)
minor clean-up `zencore/memory.h` used to contain a variety of things including `Malloc` support along with `MemoryView` etc since the memory allocator stuff moved into `zencore/memory/memory.h` there was basically only `MemoryView` and `MemCmp` in there which seemed better to split out into separate headers to avoid overloading `memory.h`
Diffstat (limited to 'src/zencore/memoryview.cpp')
-rw-r--r--src/zencore/memoryview.cpp45
1 files changed, 45 insertions, 0 deletions
diff --git a/src/zencore/memoryview.cpp b/src/zencore/memoryview.cpp
new file mode 100644
index 000000000..1f6a6996c
--- /dev/null
+++ b/src/zencore/memoryview.cpp
@@ -0,0 +1,45 @@
+// Copyright Epic Games, Inc. All Rights Reserved.
+
+#include <zencore/except.h>
+#include <zencore/fmtutils.h>
+#include <zencore/intmath.h>
+#include <zencore/memory/memory.h>
+#include <zencore/memoryview.h>
+#include <zencore/testing.h>
+#include <zencore/zencore.h>
+
+#include <cstdlib>
+
+namespace zen {
+
+//
+// Unit tests
+//
+
+#if ZEN_WITH_TESTS
+
+TEST_CASE("MemoryView")
+{
+ {
+ uint8_t Array1[16] = {};
+ MemoryView View1 = MakeMemoryView(Array1);
+ CHECK(View1.GetSize() == 16);
+ }
+
+ {
+ uint32_t Array2[16] = {};
+ MemoryView View2 = MakeMemoryView(Array2);
+ CHECK(View2.GetSize() == 64);
+ }
+
+ CHECK(MakeMemoryView<float>({1.0f, 1.2f}).GetSize() == 8);
+}
+
+void
+memory_forcelink()
+{
+}
+
+#endif
+
+} // namespace zen