summaryrefslogtreecommitdiffhomepage
path: root/dev/examples/opt
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal@nekernel.org>2025-11-23 20:16:02 -0500
committerGitHub <noreply@github.com>2025-11-23 20:16:02 -0500
commit85f89ee4bb137100cbeffcbc10168eb8ea52e6cc (patch)
treef6e2063319ceaaa02f523fb5c289e4f37411a2df /dev/examples/opt
parent9a70f32ddaec0eef99efbf7ff5597c2adf08f45a (diff)
parent65a8349aa5526d071b18cd4d42586c46faaa3823 (diff)
Merge pull request #18 from amlel-el-mahrouss/developv1.0.48
OCL v1.0.48
Diffstat (limited to 'dev/examples/opt')
-rw-r--r--dev/examples/opt/CMakeLists.txt12
-rw-r--r--dev/examples/opt/opt.cc45
2 files changed, 0 insertions, 57 deletions
diff --git a/dev/examples/opt/CMakeLists.txt b/dev/examples/opt/CMakeLists.txt
deleted file mode 100644
index b63b1de..0000000
--- a/dev/examples/opt/CMakeLists.txt
+++ /dev/null
@@ -1,12 +0,0 @@
-
-cmake_minimum_required(VERSION 3.15...3.31)
-
-project(
- Opt
- VERSION 1.0
- LANGUAGES CXX)
-
-add_executable(Opt opt.cc)
-
-set_property(TARGET Opt PROPERTY CXX_STANDARD 20)
-target_include_directories(Opt PUBLIC ../../)
diff --git a/dev/examples/opt/opt.cc b/dev/examples/opt/opt.cc
deleted file mode 100644
index acd59fd..0000000
--- a/dev/examples/opt/opt.cc
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- String checksum example
- Written by Amlal El Mahrouss.
- Licensed under the Boost Software License
- */
-
-#include <lib/logic/opt.hpp>
-#include <lib/io/print.hpp>
-#include <lib/utility/crc32.hpp>
-#include <string>
-
-static const char do_hash(const std::string& in)
-{
- int hash = 0;
-
- for (long index = 0; index < in.size(); ++index)
- {
- hash += in[index];
- }
-
- return hash;
-}
-
-static auto do_some(const std::string recv_data, const std::string check_data)
-{
- const int hash_to_check = do_hash(check_data); /* here we assume this should match opt_hash */
- const int opt_hash = do_hash(recv_data); /* we assume that the hash is correct */
-
- auto opt = ocl::opt(ocl::eval_eq(hash_to_check, opt_hash)); /* do the compute */
- return opt;
-}
-
-/* finally test it */
-int main(int argc, char** argv)
-{
- // ... let's assume we fetch data from network...
-
- ocl::io::println("Testing data...");
-
- auto opt = do_some("Ohio", "Ohio");
- opt.expect("Checksum failed, Ohio isn't Ohio!");
-
-
- return 0;
-}