mirror of
https://git.suyu.dev/suyu/dynarmic.git
synced 2025-12-29 18:54:47 +01:00
Squashed 'externals/mp/' changes from 29cb5588d..649fde1e8
649fde1e8 typelist: Add drop 5efe868da travis: Drop GCC 7 from CI c3f890f17 Update to use new metavalue types c4dd1c9b9 metavalue: Add some common operations 7da45c71b Remove unnecessary public keyword for struct inheritance 287d8e7ec Correct typos in file headers git-subtree-dir: externals/mp git-subtree-split: 649fde1e814f9ce5b04d7ddeb940244d9f63cb2f
This commit is contained in:
parent
7b0c47d3f0
commit
1925d4dcc6
22 changed files with 460 additions and 24 deletions
|
|
@ -7,17 +7,83 @@
|
|||
|
||||
#include <type_traits>
|
||||
|
||||
#include <mp/metavalue/bit_and.h>
|
||||
#include <mp/metavalue/bit_not.h>
|
||||
#include <mp/metavalue/bit_or.h>
|
||||
#include <mp/metavalue/bit_xor.h>
|
||||
#include <mp/metavalue/conjunction.h>
|
||||
#include <mp/metavalue/disjunction.h>
|
||||
#include <mp/metavalue/lift_value.h>
|
||||
#include <mp/metavalue/logic_and.h>
|
||||
#include <mp/metavalue/logic_not.h>
|
||||
#include <mp/metavalue/logic_or.h>
|
||||
#include <mp/metavalue/product.h>
|
||||
#include <mp/metavalue/sum.h>
|
||||
#include <mp/metavalue/value.h>
|
||||
#include <mp/metavalue/value_cast.h>
|
||||
#include <mp/metavalue/value_equal.h>
|
||||
|
||||
using namespace mp;
|
||||
|
||||
// bit_and
|
||||
|
||||
static_assert(bit_and<lift_value<3>, lift_value<1>>::value == 1);
|
||||
|
||||
// bit_not
|
||||
|
||||
static_assert(bit_not<lift_value<0>>::value == ~0);
|
||||
|
||||
// bit_or
|
||||
|
||||
static_assert(bit_or<lift_value<1>, lift_value<3>>::value == 3);
|
||||
|
||||
// bit_xor
|
||||
|
||||
static_assert(bit_xor<lift_value<1>, lift_value<3>>::value == 2);
|
||||
|
||||
// conjunction
|
||||
|
||||
static_assert(std::is_same_v<conjunction<std::true_type>, std::true_type>);
|
||||
static_assert(std::is_same_v<conjunction<std::true_type, lift_value<0>>, lift_value<0>>);
|
||||
static_assert(std::is_same_v<conjunction<std::true_type, lift_value<42>, std::true_type>, std::true_type>);
|
||||
|
||||
// disjunction
|
||||
|
||||
static_assert(std::is_same_v<disjunction<std::true_type>, std::true_type>);
|
||||
static_assert(std::is_same_v<disjunction<std::false_type, lift_value<0>>, lift_value<0>>);
|
||||
static_assert(std::is_same_v<disjunction<std::false_type, lift_value<42>, std::true_type>, lift_value<42>>);
|
||||
|
||||
// lift_value
|
||||
|
||||
static_assert(std::is_same_v<lift_value<3>, std::integral_constant<int, 3>>);
|
||||
static_assert(std::is_same_v<lift_value<false>, std::false_type>);
|
||||
|
||||
// logic_and
|
||||
|
||||
static_assert(std::is_same_v<logic_and<>, std::true_type>);
|
||||
static_assert(std::is_same_v<logic_and<std::true_type>, std::true_type>);
|
||||
static_assert(std::is_same_v<logic_and<lift_value<1>>, std::true_type>);
|
||||
static_assert(std::is_same_v<logic_and<std::true_type, std::false_type>, std::false_type>);
|
||||
|
||||
// logic_not
|
||||
|
||||
static_assert(std::is_same_v<logic_not<std::false_type>, std::true_type>);
|
||||
|
||||
// logic_or
|
||||
|
||||
static_assert(std::is_same_v<logic_or<>, std::false_type>);
|
||||
static_assert(std::is_same_v<logic_or<std::true_type>, std::true_type>);
|
||||
static_assert(std::is_same_v<logic_or<lift_value<0>>, std::false_type>);
|
||||
static_assert(std::is_same_v<logic_or<std::true_type, std::false_type>, std::true_type>);
|
||||
|
||||
// product
|
||||
|
||||
static_assert(product<lift_value<1>, lift_value<2>, lift_value<3>, lift_value<4>>::value == 24);
|
||||
|
||||
// sum
|
||||
|
||||
static_assert(sum<lift_value<1>, lift_value<2>, lift_value<3>, lift_value<4>>::value == 10);
|
||||
|
||||
// value_cast
|
||||
|
||||
static_assert(std::is_same_v<value_cast<int, std::true_type>, std::integral_constant<int, 1>>);
|
||||
|
|
|
|||
|
|
@ -10,10 +10,13 @@
|
|||
#include <type_traits>
|
||||
#include <utility>
|
||||
|
||||
#include <mp/metavalue/value.h>
|
||||
|
||||
#include <mp/typelist/append.h>
|
||||
#include <mp/typelist/cartesian_product.h>
|
||||
#include <mp/typelist/concat.h>
|
||||
#include <mp/typelist/contains.h>
|
||||
#include <mp/typelist/drop.h>
|
||||
#include <mp/typelist/get.h>
|
||||
#include <mp/typelist/head.h>
|
||||
#include <mp/typelist/length.h>
|
||||
|
|
@ -60,6 +63,14 @@ static_assert(!contains_v<list<>, int>);
|
|||
static_assert(!contains_v<list<double>, int>);
|
||||
static_assert(contains_v<list<double, int>, int>);
|
||||
|
||||
// drop
|
||||
|
||||
static_assert(std::is_same_v<list<>, drop<3, list<int, int>>>);
|
||||
static_assert(std::is_same_v<list<>, drop<3, list<int, int, int>>>);
|
||||
static_assert(std::is_same_v<list<int>, drop<3, list<int, int, int, int>>>);
|
||||
static_assert(std::is_same_v<list<double>, drop<3, list<int, int, int, double>>>);
|
||||
static_assert(std::is_same_v<list<int, double, bool>, drop<0, list<int, double, bool>>>);
|
||||
|
||||
// get
|
||||
|
||||
static_assert(std::is_same_v<get<0, list<int, double>>, int>);
|
||||
|
|
@ -81,13 +92,13 @@ static_assert(length_v<list<int, int, int>> == 3);
|
|||
static_assert(
|
||||
std::is_same_v<
|
||||
lift_sequence<std::make_index_sequence<3>>,
|
||||
list<std::integral_constant<std::size_t, 0>, std::integral_constant<std::size_t, 1>, std::integral_constant<std::size_t, 2>>
|
||||
list<size_value<0>, size_value<1>, size_value<2>>
|
||||
>
|
||||
);
|
||||
|
||||
// lower_to_tuple
|
||||
|
||||
static_assert(lower_to_tuple_v<list<std::integral_constant<std::size_t, 0>, std::integral_constant<std::size_t, 1>, std::integral_constant<std::size_t, 2>>> == std::tuple<std::size_t, std::size_t, std::size_t>(0, 1, 2));
|
||||
static_assert(lower_to_tuple_v<list<size_value<0>, size_value<1>, size_value<2>>> == std::tuple<std::size_t, std::size_t, std::size_t>(0, 1, 2));
|
||||
static_assert(lower_to_tuple_v<list<std::true_type, std::false_type>> == std::make_tuple(true, false));
|
||||
|
||||
// prepend
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue