summaryrefslogtreecommitdiffhomepage
path: root/include/ocl
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal@nekernel.org>2026-02-27 22:37:31 +0100
committerAmlal El Mahrouss <amlal@nekernel.org>2026-02-27 22:37:31 +0100
commitf7a6fd9a6efd7a603e534242f3aa21e782a61958 (patch)
treeeb442cdbdc2e21593d2acc2659328f09e97cb5a9 /include/ocl
parentc5b3eb06fd0fd4f1f29b5c76c1b8865c55b88ea9 (diff)
feat: moving checksum to sources directory, update file structure.
Signed-off-by: Amlal El Mahrouss <amlal@nekernel.org>
Diffstat (limited to 'include/ocl')
-rw-r--r--include/ocl/fix/checksum.hpp30
1 files changed, 4 insertions, 26 deletions
diff --git a/include/ocl/fix/checksum.hpp b/include/ocl/fix/checksum.hpp
index 2672996..5d9fa8b 100644
--- a/include/ocl/fix/checksum.hpp
+++ b/include/ocl/fix/checksum.hpp
@@ -18,42 +18,20 @@ namespace ocl::fix
/// \brief Returns the checksum index of a FIX message.
/// \param range the range_buffer containing the message.
/// \throws runtime_error if the FIX message is invalid (missing tag "8").
-
- inline std::string try_index_checksum(range_buffer& fix)
- {
- if (fix.is_valid())
- return fix["10"];
- else
- ::ocl::fix::detail::throw_runtime_error();
-
- ::ocl::fix::detail::unreachable();
-
- return {};
- }
+ std::string try_index_checksum(range_buffer& fix);
/// \brief FIX message operators namespace.
namespace operators
{
-
+
using checksum_type = long long;
/// \brief Calculates the FIX protocol checksum for a message.
/// \param in_ Pointer to the message buffer.
/// \param len Length of the message in bytes.
/// \return The checksum value (sum of all bytes modulo 256).
- constexpr inline checksum_type
- checksum(const std::string_view& in_) noexcept
- {
- checksum_type cks{};
-
- for (std::size_t idx{};
- idx < in_.size(); ++idx)
- cks += static_cast<uint8_t>(in_[idx]);
-
- // add \0
- cks += 1;
- return cks % 256;
- }
+ checksum_type
+ checksum(const boost::string_view& in_) noexcept;
} // namespace operators