mini-llvm
0.1.0
Toggle main menu visibility
Loading...
Searching...
No Matches
Mul.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
9
namespace
mini_llvm::ops
{
10
11
struct
Mul
{
12
template
<
typename
T>
13
requires
std::integral<T>
14
T
operator()
(T x, T y)
const
noexcept
{
15
return
16
std::bit_cast<T>(
17
static_cast<
std::make_unsigned_t<T>
>
(
18
std::bit_cast<std::make_unsigned_t<T>>(x) * std::bit_cast<std::make_unsigned_t<T>>(y)));
19
}
20
21
bool
operator()
(
bool
x,
bool
y)
const
noexcept
{
22
return
x && y;
23
}
24
};
25
26
}
// namespace mini_llvm::ops
mini_llvm::ops
Definition
Add.h:9
mini_llvm::ops::Mul
Definition
Mul.h:11
mini_llvm::ops::Mul::operator()
T operator()(T x, T y) const noexcept
Definition
Mul.h:14
mini_llvm::ops::Mul::operator()
bool operator()(bool x, bool y) const noexcept
Definition
Mul.h:21
include
mini-llvm
common
ops
Mul.h
Generated by
1.17.0