diff options
| author | Amlal El Mahrouss <amlal@nekernel.org> | 2025-09-10 03:28:35 +0200 |
|---|---|---|
| committer | Amlal El Mahrouss <amlal@nekernel.org> | 2025-09-10 03:28:35 +0200 |
| commit | 3f9c5017abf3c4279780f685580a334574e6d760 (patch) | |
| tree | a54540a8549542bf5385ae5b17878949b011aae4 /dev/lib | |
| parent | 2ecbd2bfb27060b6f45196d8481fd0ccdbea730c (diff) | |
feat:! breaking changes in the `opt` module. Fix `println` in `io`
module.
Signed-off-by: Amlal El Mahrouss <amlal@nekernel.org>
Diffstat (limited to 'dev/lib')
| -rw-r--r-- | dev/lib/io/print.hpp | 1 | ||||
| -rw-r--r-- | dev/lib/logic/opt.hpp | 17 | ||||
| -rw-r--r-- | dev/lib/simd/avx.hpp | 21 |
3 files changed, 37 insertions, 2 deletions
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 |
