fix: fix some bugs in tools

This commit is contained in:
DarkSharpness
2024-07-24 10:32:27 +08:00
parent 63ffb230d4
commit 8434f3f137
3 changed files with 12 additions and 16 deletions

View File

@ -1,5 +1,6 @@
#pragma once
#include "bit.h"
#include "register.h"
namespace dark {
@ -75,7 +76,7 @@ constexpr auto operator^(const _Tp &lhs, const _Up &rhs) {
}
template<typename _Tp>
concept int_or_bit = int_type<_Tp> || bit_type<_Tp>;
concept int_or_bit = int_type<_Tp> || bit_type<std::decay_t<_Tp>>;
template<bit_type _Tp, int_or_bit _Up>
constexpr auto operator<<(const _Tp &lhs, const _Up &rhs) {
@ -107,25 +108,20 @@ constexpr auto operator-(const _Tp &value) {
return Bit<_Tp::_Bit_Len>(-cast(value));
}
template<int_or_bit _Tp, int_or_bit _Up>
constexpr bool operator&&(const _Tp &lhs, const _Up &rhs) {
return cast(lhs) && cast(rhs);
}
template<int_or_bit _Tp, int_or_bit _Up>
constexpr bool operator||(const _Tp &lhs, const _Up &rhs) {
return cast(lhs) || cast(rhs);
}
template<int_or_bit _Tp, int_or_bit _Up>
constexpr bool operator==(const _Tp &lhs, const _Up &rhs) {
return cast(lhs) == cast(rhs);
}
template <typename _Tp>
inline constexpr bool is_reg_ref_v = false;
template <std::size_t _Len>
inline constexpr bool is_reg_ref_v<Register<_Len> &> = true;
template<int_or_bit _Tp, int_or_bit _Up>
constexpr auto operator<=>(const _Tp &lhs, const _Up &rhs) {
constexpr auto operator <=> (const _Tp &lhs, const _Up &rhs) {
return cast(lhs) <=> cast(rhs);
}
} // namespace dark