From c55098f6b3b16f6325e1f7bdec69e4f96c550f9c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roland=20Lei=C3=9Fa?= Date: Wed, 6 Dec 2023 15:23:27 +0100 Subject: [PATCH] missing file --- include/thorin/normalize.h | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 include/thorin/normalize.h diff --git a/include/thorin/normalize.h b/include/thorin/normalize.h new file mode 100644 index 0000000000..087d8e912e --- /dev/null +++ b/include/thorin/normalize.h @@ -0,0 +1,23 @@ +#pragma once + +#include + +namespace thorin { + +class Res { +public: + Res() + : data_{} {} + template + Res(T val) + : data_(thorin::bitcast(val)) {} + + constexpr const u64& operator*() const& { return *data_; } + constexpr u64& operator*() & { return *data_; } + explicit operator bool() const { return data_.has_value(); } + +private: + std::optional data_; +}; + +} // namespace thorin