diff options
Diffstat (limited to 'dev/lib/logic')
| -rw-r--r-- | dev/lib/logic/equiv.hpp | 16 | ||||
| -rw-r--r-- | dev/lib/logic/math.hpp | 6 | ||||
| -rw-r--r-- | dev/lib/logic/opt.hpp | 12 |
3 files changed, 18 insertions, 16 deletions
diff --git a/dev/lib/logic/equiv.hpp b/dev/lib/logic/equiv.hpp index 2f63673..5b022f8 100644 --- a/dev/lib/logic/equiv.hpp +++ b/dev/lib/logic/equiv.hpp @@ -1,13 +1,14 @@ /* * File: equiv.hpp * Purpose: Equivalence runtime c++ header. - * Author: Amlal El Mahrouss (founder@snu.systems) - * Copyright 2025, Amlal El Mahrouss and SNU Systems Corp. + * Author: Amlal El Mahrouss (amlal@nekernel.org) + * Copyright 2025, Amlal El Mahrouss */ #pragma once -namespace snu::equiv +/// @brief OCL equivalence namespace. +namespace ocl::equiv { template <typename T> struct basic_hash_trait @@ -59,7 +60,7 @@ namespace snu::equiv struct equiv_is_int8 { private: - T left_ = 255, right_ = 255; + T left_ = 127, right_ = 127; public: using result = T; @@ -74,7 +75,8 @@ namespace snu::equiv struct equiv_not_int8 { private: - T left_ = 255, right_ = 255; + // these shall overflow if not int8. + T left_ = 127, right_ = 127; public: using result = T; @@ -96,7 +98,7 @@ namespace snu::equiv constexpr result hash() { - return left_ / right_; + return left_ / right_ == 1; } }; -} // namespace snu::equiv
\ No newline at end of file +} // namespace ocl::equiv diff --git a/dev/lib/logic/math.hpp b/dev/lib/logic/math.hpp index cab995a..e796eae 100644 --- a/dev/lib/logic/math.hpp +++ b/dev/lib/logic/math.hpp @@ -1,7 +1,7 @@ /* * File: math.hpp * Purpose: Mathematics c++ header. - * Author: Amlal El Mahrouss (founder@snu.systems) + * Author: Amlal El Mahrouss (amlal@nekernel.org) * Copyright 2025, Amlal El Mahrouss. */ @@ -9,7 +9,7 @@ #include <cmath> -namespace snu::math +namespace ocl { template <std::size_t T> struct is_non_boolean_integer final @@ -32,4 +32,4 @@ namespace snu::math constexpr inline auto not_a_number = NAN; constexpr inline auto positive_infinity = INFINITY; constexpr inline auto negative_infinity = -positive_infinity; -} // namespace snu::math
\ No newline at end of file +} // namespace ocl
\ No newline at end of file diff --git a/dev/lib/logic/opt.hpp b/dev/lib/logic/opt.hpp index a8e66b4..442756c 100644 --- a/dev/lib/logic/opt.hpp +++ b/dev/lib/logic/opt.hpp @@ -1,16 +1,16 @@ /* * File: opt.hpp * Author: Amlal El Mahrouss, - * Copyright 2023-2025, Amlal El Mahrouss/SNU Systems Corp. + * Copyright 2023-2025, Amlal El Mahrouss */ -#ifndef _SNU_OPT_HPP -#define _SNU_OPT_HPP +#ifndef _OCL_OPT_HPP +#define _OCL_OPT_HPP #include <lib/except/error.hpp> #include <utility> -namespace snu +namespace ocl { enum class return_type { @@ -116,6 +116,6 @@ namespace snu { return return_type::err; } -} // namespace snu +} // namespace ocl -#endif /* ifndef _SNU_OPT_HPP */ +#endif /* ifndef _OCL_OPT_HPP */ |
