summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--README.md10
-rw-r--r--dev/examples/opt/opt.cc2
-rw-r--r--dev/lib/io/print.hpp1
-rw-r--r--dev/lib/logic/opt.hpp17
-rw-r--r--dev/lib/simd/avx.hpp21
5 files changed, 43 insertions, 8 deletions
diff --git a/README.md b/README.md
index b7790c3..0e876d7 100644
--- a/README.md
+++ b/README.md
@@ -1,10 +1,10 @@
-# Open C++ Library
+# SIMD C++ Library
[![License: GPL-2.0](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
## Brief:
-A C++ library with additional modules for your C++ SDLC.
+A C++ library with additional modules for your C++ SDLC. Based on the Open C++ Library.
## Requirements:
@@ -21,10 +21,10 @@ A C++ library with additional modules for your C++ SDLC.
int main(int argc, char** argv)
{
- auto opt = ocl::opt(ocl::eval_eq(50, 50)).expect("ocl::eval_eq, does not match!");
+ auto opt = ocl::opt(ocl::eval_eq(50, 50)).try_or_throw("ocl::eval_eq, does not match!");
opt = ocl::opt(ocl::eval_eq(50, 40));
- opt.expect("this time it doesn't.");
-
+ opt.try_or_throw("this time it doesn't.");
+
return EXIT_SUCCESS;
}
```
diff --git a/dev/examples/opt/opt.cc b/dev/examples/opt/opt.cc
index b34f2c7..8a74fa2 100644
--- a/dev/examples/opt/opt.cc
+++ b/dev/examples/opt/opt.cc
@@ -38,7 +38,7 @@ int main(int argc, char** argv)
ocl::io::println("Testing data...");
auto opt = do_some("Ohio", "Ohio");
- opt.expect("Checksum failed, Ohio isn't Ohio!");
+ opt.try_or_throw("Checksum failed, Ohio isn't Ohio!");
return 0;
diff --git a/dev/lib/io/print.hpp b/dev/lib/io/print.hpp
index 4b32ddb..40ae1bb 100644
--- a/dev/lib/io/print.hpp
+++ b/dev/lib/io/print.hpp
@@ -35,6 +35,7 @@ namespace ocl::io
inline void println(T... fmt) noexcept
{
print(fmt...);
+ print();
}
} // namespace ocl::io
diff --git a/dev/lib/logic/opt.hpp b/dev/lib/logic/opt.hpp
index 442756c..137460c 100644
--- a/dev/lib/logic/opt.hpp
+++ b/dev/lib/logic/opt.hpp
@@ -20,6 +20,7 @@ namespace ocl
count = err - okay + 1,
};
+ template <typename char_type = char>
struct opt final
{
explicit opt(const return_type& return_type)
@@ -27,11 +28,23 @@ namespace ocl
{
}
- opt& expect(const char* input)
+ template <typename ErrorHandler>
+ opt& try_or_handle(const char_type* input)
{
if (m_ret == return_type::err)
{
- throw std::runtime_error(input);
+ ErrorHandler handler;
+ handler(input ? input : "");
+ }
+
+ return *this;
+ }
+
+ opt& try_or_throw(const char_type* input)
+ {
+ if (m_ret == return_type::err)
+ {
+ throw std::runtime_error(input ? input : "");
}
return *this;
diff --git a/dev/lib/simd/avx.hpp b/dev/lib/simd/avx.hpp
index e69de29..16e495e 100644
--- a/dev/lib/simd/avx.hpp
+++ b/dev/lib/simd/avx.hpp
@@ -0,0 +1,21 @@
+/*
+ * File: simd/avx.hpp
+ * Purpose: AVX C++ library.
+ * Author: Amlal El Mahrouss (founder@snu.systems)
+ * Copyright 2025, Amlal El Mahrouss, and SNU Systems, Corp, licensed under the BSL 1.0 license.
+ */
+
+#pragma once
+
+#include <lib/core/includes.hpp>
+
+namespace ocl::snu::simd
+{
+ struct avx_256_backend final
+ {
+ std::basic_string<char> isa()
+ {
+ return "AVX-256";
+ }
+ };
+} // namespace ocl::snu::simd