3 #ifndef LALA_CORE_B_HPP
4 #define LALA_CORE_B_HPP
6 #include "battery/memory.hpp"
10 template <
class Mem>
class B;
25 using value_type = bool;
26 using memory_type = Mem;
30 using this_type2 =
B<M>;
32 using local_type = this_type2<battery::local_memory>;
34 constexpr
static const bool sequential = Mem::sequential;
35 constexpr
static const bool is_totally_ordered =
true;
36 constexpr
static const bool complemented =
true;
37 constexpr
static const char* name =
"B";
40 using atomic_type = memory_type::template atomic_type<value_type>;
44 CUDA
static constexpr local_type bot() {
return false; }
45 CUDA
static constexpr local_type top() {
return true; }
46 CUDA constexpr
B(): val(false) {}
47 CUDA constexpr
B(value_type x): val(x) {}
48 CUDA constexpr
B(
const this_type& other):
B(other.value()) {}
49 constexpr
B(this_type&& other) =
default;
52 CUDA constexpr
B(
const this_type2<M>& other):
B(other.value()) {}
58 CUDA constexpr this_type& operator=(
const this_type2<M>& other) {
59 memory_type::store(val, other.value());
64 CUDA constexpr this_type& operator=(
const this_type& other) {
65 memory_type::store(val, other.value());
69 CUDA constexpr this_type& operator=(
bool other) {
74 CUDA constexpr value_type value()
const {
return memory_type::load(val); }
77 CUDA constexpr
operator value_type()
const {
return value(); }
82 CUDA constexpr
B is_top()
const {
89 CUDA constexpr
B is_bot()
const {
94 CUDA constexpr
void join_top() {
95 memory_type::store(val,
true);
102 CUDA constexpr
bool join(
const this_type2<M1>& other) {
103 if(!value() && other.value()) {
104 memory_type::store(val,
true);
111 CUDA constexpr
void meet_bot() {
112 memory_type::store(val,
false);
119 CUDA constexpr
bool meet(
const this_type2<M1>& other) {
120 if(value() && !other.value()) {
121 memory_type::store(val,
false);
127 CUDA constexpr
bool join(value_type other) {
131 CUDA constexpr
bool meet(value_type other) {
138 CUDA NI
void print()
const {
142 CUDA constexpr this_type& operator|= (
const this_type& other) {
147 CUDA constexpr this_type& operator&= (
const this_type& other) {
152 CUDA constexpr this_type& operator|= (value_type other) {
157 CUDA constexpr this_type& operator&= (value_type other) {
168 template<
class M1,
class M2>
169 CUDA constexpr
bool operator<=(
const B<M1>& a,
const B<M2>& b) {
170 return !a.value() || b.value();
173 template<
class M1,
class M2>
174 CUDA constexpr
bool operator<(
const B<M1>& a,
const B<M2>& b) {
175 return !a.value() && b.value();
178 template<
class M1,
class M2>
179 CUDA constexpr
bool operator>=(
const B<M1>& a,
const B<M2>& b) {
183 template<
class M1,
class M2>
184 CUDA constexpr
bool operator>(
const B<M1>& a,
const B<M2>& b) {
188 template<
class M1,
class M2>
189 CUDA constexpr
bool operator==(
const B<M1>& a,
const B<M2>& b) {
190 return a.value() == b.value();
193 template<
class M1,
class M2>
194 CUDA constexpr
bool operator!=(
const B<M1>& a,
const B<M2>& b) {
195 return a.value() != b.value();
199 std::ostream&
operator<<(std::ostream &s,
const B<M> &a) {
CUDA NI void print(const lala::Sig &sig)
Definition: ast.hpp:225
::lala::B<::battery::local_memory > B
Definition: b.hpp:12
Definition: abstract_deps.hpp:14
constexpr CUDA bool operator==(const CartesianProduct< As... > &a, const CartesianProduct< Bs... > &b)
Definition: cartesian_product.hpp:504
std::ostream & operator<<(std::ostream &s, const CartesianProduct< A, As... > &cp)
Definition: cartesian_product.hpp:531
constexpr CUDA bool operator<(const CartesianProduct< As... > &a, const CartesianProduct< Bs... > &b)
Definition: cartesian_product.hpp:485
constexpr CUDA bool operator>(const CartesianProduct< As... > &a, const CartesianProduct< Bs... > &b)
Definition: cartesian_product.hpp:498