summaryrefslogtreecommitdiff
path: root/Runtime/Math/Simd/bool4.h
blob: 05afc1d0e83d811379c3b428e3f2ca5b6477bcd0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#ifndef SIMD_BOOL4_H
#define SIMD_BOOL4_H


#include "Runtime/Math/Simd/intrinsic.h"
#include "Runtime/Math/Simd/bool1.h"

namespace math
{

template<typename T> struct vecexp4;

struct ATTRIBUTE_ALIGN(ALIGN4F) bool4
{		
	typedef bool		scalar_type;
	typedef vec4b		packed_type;

	packed_type	v;

	MECANIM_FORCE_INLINE bool4() {}

	MECANIM_FORCE_INLINE bool4(const bool4 &r):v(r.v) { }

	MECANIM_FORCE_INLINE bool4(const packed_type &r):v(r) { }

	explicit MECANIM_FORCE_INLINE bool4(bool s):v(Vloadsb(s)) {  }

	explicit MECANIM_FORCE_INLINE bool4(bool1 const& r):v(r.s) {  }

	MECANIM_FORCE_INLINE bool4(bool x, bool y, bool z, bool w):v(Vload4sb(x,y,z,w)) { }

	MECANIM_FORCE_INLINE bool4 &operator=(const bool4 &r) { v = r.v; return *this; }

	MECANIM_FORCE_INLINE bool4 &operator=(bool s) { v = Vloadsb(s); return *this; }		

	MECANIM_FORCE_INLINE bool4 operator!() const { bool4 r = Vnot(v); return r; }
};

static MECANIM_FORCE_INLINE bool4 operator==(bool4 const& l, bool4 const& r)
{ 
	return bool4(Vxnor(l.v, r.v) ); 
}

static MECANIM_FORCE_INLINE bool4 operator!=(bool4 const& l, bool4 const& r)
{ 
	return bool4(Vxor(l.v, r.v) ); 
}

static MECANIM_FORCE_INLINE bool4 operator&&(bool4 const& l, bool4 const& r)
{ 
	return bool4(Vand(l.v, r.v) ); 
}

static MECANIM_FORCE_INLINE bool4 operator||(bool4 const& l, bool4 const& r)
{ 
	return bool4(Vor(l.v, r.v) ); 
}

}

#endif