PandaRoot
PSEUDO_F32vec4.h File Reference
#include <iostream>
#include <cmath>
#include "vec_arithmetic.h"

Go to the source code of this file.

Classes

class  F32vec4
 
struct  nsL1::vector< T >
 
struct  nsL1vector< T >
 

Namespaces

 nsL1
 

Macros

#define _f2(A, B, F)
 
#define _f1(A, F)
 
#define _op(A, B, O)
 
#define NotEmpty(a)   bool((a)[0]) | bool((a)[1]) | bool((a)[2]) | bool((a)[3])
 
#define Empty(a)   !(bool((a)[0]) | bool((a)[1]) | bool((a)[2]) | bool((a)[3]))
 
#define _fvecalignment
 

Typedefs

typedef F32vec4 fvec
 
typedef float fscal
 

Functions

float min (float x, float y)
 
float max (float x, float y)
 
float asgnb (float x, float y)
 
float rsqrt (float x)
 
float rcp (float x)
 
float sgn (float x)
 
class F32vec4 __attribute__ ((aligned(16)))
 
float & operator[] (int i)
 
 F32vec4 ()
 
 F32vec4 (const F32vec4 &a)
 
 F32vec4 (const float &a)
 
 F32vec4 (const float &f0, const float &f1, const float &f2, const float &f3)
 
F32vec4 operator+ (const F32vec4 &a, const F32vec4 &b)
 
F32vec4 operator- (const F32vec4 &a, const F32vec4 &b)
 
F32vec4 operator* (const F32vec4 &a, const F32vec4 &b)
 
F32vec4 operator/ (const F32vec4 &a, const F32vec4 &b)
 
F32vec4 operator< (const F32vec4 &a, const F32vec4 &b)
 
F32vec4 operator<= (const F32vec4 &a, const F32vec4 &b)
 
F32vec4 operator> (const F32vec4 &a, const F32vec4 &b)
 
F32vec4 operator>= (const F32vec4 &a, const F32vec4 &b)
 
F32vec4 operator & (const F32vec4 &a, const F32vec4 &b)
 
F32vec4 operator| (const F32vec4 &a, const F32vec4 &b)
 
F32vec4 operator|| (const F32vec4 &a, const F32vec4 &b)
 
F32vec4 operator! (const F32vec4 &a)
 
F32vec4 if3 (const F32vec4 &a, const F32vec4 &b, const F32vec4 &c)
 
F32vec4 bool2int (const F32vec4 &a)
 
F32vec4 min (const F32vec4 &a, const F32vec4 &b)
 
F32vec4 max (const F32vec4 &a, const F32vec4 &b)
 
F32vec4 asgnb (const F32vec4 &a, const F32vec4 &b)
 
F32vec4 sqrt (const F32vec4 &a)
 
F32vec4 rsqrt (const F32vec4 &a)
 
F32vec4 rcp (const F32vec4 &a)
 
F32vec4 fabs (const F32vec4 &a)
 
F32vec4 sgn (const F32vec4 &a)
 
F32vec4 exp (const F32vec4 &a)
 
F32vec4 log (const F32vec4 &a)
 
F32vec4 sin (const F32vec4 &a)
 
F32vec4 cos (const F32vec4 &a)
 
 vec_arithmetic (F32vec4, float)
 
ostream & operator<< (ostream &strm, const F32vec4 &a)
 
istream & operator>> (istream &strm, F32vec4 &a)
 

Variables

float v [4]
 
const int fvecLen = 4
 
nsL1vector __attribute__
 

Macro Definition Documentation

◆ _f1

#define _f1 (   A,
 
)
Value:
F32vec4 z; \
z.v[0] = F(A.v[0]); \
z.v[1] = F(A.v[1]); \
z.v[2] = F(A.v[2]); \
z.v[3] = F(A.v[3]); \
return z;
__m128 v
Definition: P4_F32vec4.h:52

Definition at line 70 of file PSEUDO_F32vec4.h.

Referenced by cos(), exp(), fabs(), log(), rcp(), sgn(), and sin().

◆ _f2

#define _f2 (   A,
  B,
 
)
Value:
F32vec4 z; \
z.v[0] = F(A.v[0], B.v[0]); \
z.v[1] = F(A.v[1], B.v[1]); \
z.v[2] = F(A.v[2], B.v[2]); \
z.v[3] = F(A.v[3], B.v[3]); \
return z;
__m128 v
Definition: P4_F32vec4.h:52

Definition at line 63 of file PSEUDO_F32vec4.h.

Referenced by asgnb(), rsqrt(), and sqrt().

◆ _fvecalignment

#define _fvecalignment

Definition at line 185 of file PSEUDO_F32vec4.h.

◆ _op

#define _op (   A,
  B,
 
)
Value:
F32vec4 z; \
z.v[0] = A.v[0] O B.v[0]; \
z.v[1] = A.v[1] O B.v[1]; \
z.v[2] = A.v[2] O B.v[2]; \
z.v[3] = A.v[3] O B.v[3]; \
return z;
__m128 v
Definition: P4_F32vec4.h:52

Definition at line 77 of file PSEUDO_F32vec4.h.

Referenced by operator!(), operator*(), operator/(), operator>(), operator>=(), and operator||().

◆ Empty

#define Empty (   a)    !(bool((a)[0]) | bool((a)[1]) | bool((a)[2]) | bool((a)[3]))

Definition at line 125 of file PSEUDO_F32vec4.h.

◆ NotEmpty

#define NotEmpty (   a)    bool((a)[0]) | bool((a)[1]) | bool((a)[2]) | bool((a)[3])

Definition at line 124 of file PSEUDO_F32vec4.h.

Typedef Documentation

◆ fscal

typedef float fscal

Definition at line 181 of file PSEUDO_F32vec4.h.

◆ fvec

typedef F32vec4 fvec

Definition at line 178 of file PSEUDO_F32vec4.h.

Function Documentation

◆ __attribute__()

class F32vec4 __attribute__ ( (aligned(16))  )

◆ asgnb() [1/2]

float asgnb ( float  x,
float  y 
)

Definition at line 136 of file PSEUDO_F32vec4.h.

136 { return x < y ? x : y; }

◆ asgnb() [2/2]

friend F32vec4 __attribute__::asgnb ( const F32vec4 a,
const F32vec4 b 
)

Definition at line 143 of file PSEUDO_F32vec4.h.

References _f2, and F32vec4::min.

143 { _f2(a, b, min) }
float min(float x, float y)
#define _f2(A, B, F)

◆ bool2int()

friend F32vec4 __attribute__::bool2int ( const F32vec4 a)

Definition at line 128 of file PSEUDO_F32vec4.h.

131  { // mask returned

◆ cos()

friend F32vec4 __attribute__::cos ( const F32vec4 a)

Definition at line 152 of file PSEUDO_F32vec4.h.

References _f1, and F32vec4::log.

152 { _f1(a, log) }
#define _f1(A, F)
friend F32vec4 log(const F32vec4 &a)

◆ exp()

friend F32vec4 __attribute__::exp ( const F32vec4 a)

Definition at line 149 of file PSEUDO_F32vec4.h.

References _f1, and F32vec4::fabs.

149 { _f1(a, fabs) }
#define _f1(A, F)
friend F32vec4 fabs(const F32vec4 &a)

◆ F32vec4() [1/4]

__attribute__::F32vec4 ( )

Definition at line 39 of file PSEUDO_F32vec4.h.

References i.

39 { return ((float *)&v)[i]; }
float v[4]
unsigned int i
Definition: P4_F32vec4.h:33

◆ F32vec4() [2/4]

__attribute__::F32vec4 ( const F32vec4 a)

Definition at line 40 of file PSEUDO_F32vec4.h.

41  {}
42  F32vec4(const F32vec4 &a)
43  {
44  v[0] = a.v[0];
45  v[1] = a.v[1];
46  v[2] = a.v[2];
float v[4]
F32vec4()
__m128 v
Definition: P4_F32vec4.h:52

◆ F32vec4() [3/4]

__attribute__::F32vec4 ( const float &  a)

Definition at line 47 of file PSEUDO_F32vec4.h.

50  {
51  v[0] = a;
52  v[1] = a;
53  v[2] = a;
float v[4]

◆ F32vec4() [4/4]

__attribute__::F32vec4 ( const float &  f0,
const float &  f1,
const float &  f2,
const float &  f3 
)

Definition at line 55 of file PSEUDO_F32vec4.h.

58  {
59  v[0] = f0;
60  v[1] = f1;
61  v[2] = f2;
float v[4]

◆ fabs()

friend F32vec4 __attribute__::fabs ( const F32vec4 a)

Definition at line 147 of file PSEUDO_F32vec4.h.

References _f1, and F32vec4::rsqrt.

147 { _f1(a, rsqrt) }
#define _f1(A, F)
float rsqrt(float x)

◆ if3()

friend F32vec4 __attribute__::if3 ( const F32vec4 a,
const F32vec4 b,
const F32vec4 c 
)

Definition at line 113 of file PSEUDO_F32vec4.h.

116  {
117  F32vec4 z;
118  z[0] = (a[0]) ? b[0] : c[0];
119  z[1] = (a[1]) ? b[1] : c[1];
120  z[2] = (a[2]) ? b[2] : c[2];
121  z[3] = (a[3]) ? b[3] : c[3];
122 

◆ log()

friend F32vec4 __attribute__::log ( const F32vec4 a)

Definition at line 150 of file PSEUDO_F32vec4.h.

References _f1, and F32vec4::sgn.

150 { _f1(a, sgn) }
#define _f1(A, F)
float sgn(float x)

◆ max() [1/2]

float max ( float  x,
float  y 
)

Definition at line 135 of file PSEUDO_F32vec4.h.

136 { return x < y ? x : y; }

◆ max() [2/2]

friend F32vec4 __attribute__::max ( const F32vec4 a,
const F32vec4 b 
)

Definition at line 142 of file PSEUDO_F32vec4.h.

143 { _f2(a, b, min) }
float min(float x, float y)
#define _f2(A, B, F)

◆ min() [1/2]

float min ( float  x,
float  y 
)

Definition at line 134 of file PSEUDO_F32vec4.h.

136 { return x < y ? x : y; }

◆ min() [2/2]

friend F32vec4 __attribute__::min ( const F32vec4 a,
const F32vec4 b 
)

Definition at line 141 of file PSEUDO_F32vec4.h.

141 { return x >= 0 ? 1 : -1; }

◆ operator &()

friend F32vec4 __attribute__::operator& ( const F32vec4 a,
const F32vec4 b 
)

Definition at line 98 of file PSEUDO_F32vec4.h.

100 { _op(a, b, &&) }
#define _op(A, B, O)

◆ operator!()

friend F32vec4 __attribute__::operator! ( const F32vec4 a)

Definition at line 102 of file PSEUDO_F32vec4.h.

References _op.

102  { _op(a, b, ||) }
103 
104  friend F32vec4 operator!(const F32vec4 &a)
105  {
106  F32vec4 z;
107  z[0] = !a[0];
108  z[1] = !a[1];
109  z[2] = !a[2];
110  z[3] = !a[3];
111 
#define _op(A, B, O)
friend F32vec4 operator!(const F32vec4 &a)

◆ operator*()

friend F32vec4 __attribute__::operator* ( const F32vec4 a,
const F32vec4 b 
)

Definition at line 88 of file PSEUDO_F32vec4.h.

References _op.

88 { _op(a, b, +) }
#define _op(A, B, O)

◆ operator+()

friend F32vec4 __attribute__::operator+ ( const F32vec4 a,
const F32vec4 b 
)

Definition at line 86 of file PSEUDO_F32vec4.h.

88 { _op(a, b, +) }
#define _op(A, B, O)

◆ operator-()

friend F32vec4 __attribute__::operator- ( const F32vec4 a,
const F32vec4 b 
)

Definition at line 87 of file PSEUDO_F32vec4.h.

88 { _op(a, b, +) }
#define _op(A, B, O)

◆ operator/()

friend F32vec4 __attribute__::operator/ ( const F32vec4 a,
const F32vec4 b 
)

Definition at line 89 of file PSEUDO_F32vec4.h.

References _op.

89 { _op(a, b, -) }
#define _op(A, B, O)

◆ operator<()

friend F32vec4 __attribute__::operator< ( const F32vec4 a,
const F32vec4 b 
)

Definition at line 92 of file PSEUDO_F32vec4.h.

94 { _op(a, b, <) }
#define _op(A, B, O)

◆ operator<<()

friend ostream& __attribute__::operator<< ( ostream &  strm,
const F32vec4 a 
)

Definition at line 161 of file PSEUDO_F32vec4.h.

164  {
165  strm << a[0] << " " << a[1] << " " << a[2] << " " << a[3];

◆ operator<=()

friend F32vec4 __attribute__::operator<= ( const F32vec4 a,
const F32vec4 b 
)

Definition at line 93 of file PSEUDO_F32vec4.h.

94 { _op(a, b, <) }
#define _op(A, B, O)

◆ operator>()

friend F32vec4 __attribute__::operator> ( const F32vec4 a,
const F32vec4 b 
)

Definition at line 94 of file PSEUDO_F32vec4.h.

References _op.

94 { _op(a, b, <) }
#define _op(A, B, O)

◆ operator>=()

friend F32vec4 __attribute__::operator>= ( const F32vec4 a,
const F32vec4 b 
)

Definition at line 95 of file PSEUDO_F32vec4.h.

References _op.

95 { _op(a, b, <=) }
#define _op(A, B, O)

◆ operator>>()

friend istream& __attribute__::operator>> ( istream &  strm,
F32vec4 a 
)

Definition at line 167 of file PSEUDO_F32vec4.h.

170  {
171  float tmp;
172  strm >> tmp;
173  a = tmp;

◆ operator[]()

float& __attribute__::operator[] ( int  i)

Definition at line 36 of file PSEUDO_F32vec4.h.

38 { return ((float *)&v)[i]; }
float v[4]
unsigned int i
Definition: P4_F32vec4.h:33

◆ operator|()

friend F32vec4 __attribute__::operator| ( const F32vec4 a,
const F32vec4 b 
)

Definition at line 99 of file PSEUDO_F32vec4.h.

100 { _op(a, b, &&) }
#define _op(A, B, O)

◆ operator||()

friend F32vec4 __attribute__::operator|| ( const F32vec4 a,
const F32vec4 b 
)

Definition at line 100 of file PSEUDO_F32vec4.h.

References _op.

100 { _op(a, b, &&) }
#define _op(A, B, O)

◆ rcp() [1/2]

float rcp ( float  x)

Definition at line 138 of file PSEUDO_F32vec4.h.

References F32vec4::fabs.

138 { return y >= 0 ? fabs(x) : -fabs(x); }
friend F32vec4 fabs(const F32vec4 &a)

◆ rcp() [2/2]

friend F32vec4 __attribute__::rcp ( const F32vec4 a)

Definition at line 146 of file PSEUDO_F32vec4.h.

References _f1, and F32vec4::sqrt.

146 { _f1(a, sqrt) }
#define _f1(A, F)
friend F32vec4 sqrt(const F32vec4 &a)

◆ rsqrt() [1/2]

float rsqrt ( float  x)

Definition at line 137 of file PSEUDO_F32vec4.h.

137 { return x < y ? y : x; }

◆ rsqrt() [2/2]

friend F32vec4 __attribute__::rsqrt ( const F32vec4 a)

Definition at line 145 of file PSEUDO_F32vec4.h.

References _f2, and F32vec4::asgnb.

145 { _f2(a, b, asgnb) }
float asgnb(float x, float y)
#define _f2(A, B, F)

◆ sgn() [1/2]

float sgn ( float  x)

Definition at line 139 of file PSEUDO_F32vec4.h.

References F32vec4::sqrt.

139 { return 1. / sqrt(x); }
friend F32vec4 sqrt(const F32vec4 &a)

◆ sgn() [2/2]

friend F32vec4 __attribute__::sgn ( const F32vec4 a)

Definition at line 148 of file PSEUDO_F32vec4.h.

References _f1, and F32vec4::rcp.

148 { _f1(a, rcp) }
float rcp(float x)
#define _f1(A, F)

◆ sin()

friend F32vec4 __attribute__::sin ( const F32vec4 a)

Definition at line 151 of file PSEUDO_F32vec4.h.

References _f1, and F32vec4::exp.

151 { _f1(a, exp) }
friend F32vec4 exp(const F32vec4 &a)
#define _f1(A, F)

◆ sqrt()

friend F32vec4 __attribute__::sqrt ( const F32vec4 a)

Definition at line 144 of file PSEUDO_F32vec4.h.

References _f2, and F32vec4::max.

144 { _f2(a, b, max) }
#define _f2(A, B, F)
float max(float x, float y)

◆ vec_arithmetic()

__attribute__::vec_arithmetic ( F32vec4  ,
float   
)

Variable Documentation

◆ __attribute__

nsL1vector __attribute__

◆ fvecLen

const int fvecLen = 4

Definition at line 182 of file PSEUDO_F32vec4.h.

◆ v

float v[4]

Definition at line 34 of file PSEUDO_F32vec4.h.