summaryrefslogtreecommitdiffhomepage
path: root/dev/lib
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal@nekernel.org>2025-11-18 14:13:02 +0100
committerGitHub <noreply@github.com>2025-11-18 14:13:02 +0100
commitc9fd682f3662e0eec09de49a36a4ea199656da34 (patch)
treef6e0c4c52724cd2af4cc6f469506b5552db13c3d /dev/lib
parent4fd646501b75cb1d94a6e17d2387372d72ce797b (diff)
parent54940e80e0a259f748d483291e0e7aef7dd98353 (diff)
Merge pull request #11 from amlel-el-mahrouss/develop
develop->stable: fixes and improvements.
Diffstat (limited to 'dev/lib')
-rw-r--r--dev/lib/core/chunk_string.hpp22
-rw-r--r--dev/lib/simd/simd.hpp3
2 files changed, 22 insertions, 3 deletions
diff --git a/dev/lib/core/chunk_string.hpp b/dev/lib/core/chunk_string.hpp
index 4fe5cc2..7e5360c 100644
--- a/dev/lib/core/chunk_string.hpp
+++ b/dev/lib/core/chunk_string.hpp
@@ -9,6 +9,7 @@
#define OCL_UTILITY_CHUNK_STRING_HPP
#include <lib/core/includes.hpp>
+#include <lib/io/print.hpp>
namespace ocl
{
@@ -45,6 +46,19 @@ namespace ocl
basic_chunk_string(const basic_chunk_string&) = delete;
public:
+ /// @brief Append a std::basic_string to the chunk string.
+ basic_chunk_string& operator+=(const char_type* in)
+ {
+ if (in == nullptr || bad_)
+ return *this;
+
+ const auto& sz = std::strlen(in);
+
+ this->operator+=(std::basic_string<char_type>(in, sz));
+
+ return *this;
+ }
+
basic_chunk_string& operator+=(const std::basic_string<char_type>& in)
{
if (in.empty() || bad_)
@@ -75,14 +89,18 @@ namespace ocl
return *this;
}
+ /// @brief Convert to basic_string or return from cache.
std::basic_string<char_type> str() const noexcept
{
static std::basic_string<char_type> ret;
+ const auto& sz = ret.size();
- if (ret.size() > 0)
+ if (chunk_total_ > sz)
ret.clear();
+ else
+ return ret;
- ret += packed_chunks_;
+ ret = packed_chunks_;
return ret;
}
diff --git a/dev/lib/simd/simd.hpp b/dev/lib/simd/simd.hpp
index e571b23..22650bb 100644
--- a/dev/lib/simd/simd.hpp
+++ b/dev/lib/simd/simd.hpp
@@ -22,10 +22,11 @@ namespace ocl::snu::simd
enum opcode
{
- bad,
+ bad = 0,
add,
mul,
div,
+ invalid = 0xfff,
};
public: