mini-llvm 0.1.0
Loading...
Searching...
No Matches
UIToFP.h
Go to the documentation of this file.
1// SPDX-License-Identifier: MIT
2
3#pragma once
4
5#include <bit>
6#include <concepts>
7#include <type_traits>
8
9namespace mini_llvm::ops {
10
11template <typename To>
12 requires std::floating_point<To>
13struct UIToFP {
14 template <typename From>
15 requires std::integral<From>
16 To operator()(From x) const noexcept {
17 return static_cast<To>(std::bit_cast<std::make_unsigned_t<From>>(x));
18 }
19
20 To operator()(bool x) const noexcept {
21 return static_cast<To>(x);
22 }
23};
24
25} // namespace mini_llvm::ops
Definition Add.h:9
Definition UIToFP.h:13
To operator()(bool x) const noexcept
Definition UIToFP.h:20
To operator()(From x) const noexcept
Definition UIToFP.h:16