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:40

Definition at line 58 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:40

Definition at line 51 of file PSEUDO_F32vec4.h.

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

◆ _fvecalignment

#define _fvecalignment

Definition at line 173 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:40

Definition at line 65 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 113 of file PSEUDO_F32vec4.h.

◆ NotEmpty

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

Definition at line 112 of file PSEUDO_F32vec4.h.

Typedef Documentation

◆ fscal

typedef float fscal

Definition at line 169 of file PSEUDO_F32vec4.h.

◆ fvec

typedef F32vec4 fvec

Definition at line 166 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 124 of file PSEUDO_F32vec4.h.

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

◆ asgnb() [2/2]

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

Definition at line 131 of file PSEUDO_F32vec4.h.

References _f2, and F32vec4::min.

131 { _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 116 of file PSEUDO_F32vec4.h.

119  { // mask returned

◆ cos()

friend F32vec4 __attribute__::cos ( const F32vec4 a)

Definition at line 140 of file PSEUDO_F32vec4.h.

References _f1, and F32vec4::log.

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

◆ exp()

friend F32vec4 __attribute__::exp ( const F32vec4 a)

Definition at line 137 of file PSEUDO_F32vec4.h.

References _f1, and F32vec4::fabs.

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

◆ F32vec4() [1/4]

__attribute__::F32vec4 ( )

Definition at line 27 of file PSEUDO_F32vec4.h.

References i.

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

◆ F32vec4() [2/4]

__attribute__::F32vec4 ( const F32vec4 a)

Definition at line 28 of file PSEUDO_F32vec4.h.

29  {}
30  F32vec4(const F32vec4 &a)
31  {
32  v[0] = a.v[0];
33  v[1] = a.v[1];
34  v[2] = a.v[2];
float v[4]
F32vec4()
__m128 v
Definition: P4_F32vec4.h:40

◆ F32vec4() [3/4]

__attribute__::F32vec4 ( const float &  a)

Definition at line 35 of file PSEUDO_F32vec4.h.

38  {
39  v[0] = a;
40  v[1] = a;
41  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 43 of file PSEUDO_F32vec4.h.

46  {
47  v[0] = f0;
48  v[1] = f1;
49  v[2] = f2;
float v[4]

◆ fabs()

friend F32vec4 __attribute__::fabs ( const F32vec4 a)

Definition at line 135 of file PSEUDO_F32vec4.h.

References _f1, and F32vec4::rsqrt.

135 { _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 101 of file PSEUDO_F32vec4.h.

104  {
105  F32vec4 z;
106  z[0] = (a[0]) ? b[0] : c[0];
107  z[1] = (a[1]) ? b[1] : c[1];
108  z[2] = (a[2]) ? b[2] : c[2];
109  z[3] = (a[3]) ? b[3] : c[3];
110 

◆ log()

friend F32vec4 __attribute__::log ( const F32vec4 a)

Definition at line 138 of file PSEUDO_F32vec4.h.

References _f1, and F32vec4::sgn.

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

◆ max() [1/2]

float max ( float  x,
float  y 
)

Definition at line 123 of file PSEUDO_F32vec4.h.

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

◆ max() [2/2]

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

Definition at line 130 of file PSEUDO_F32vec4.h.

131 { _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 122 of file PSEUDO_F32vec4.h.

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

◆ min() [2/2]

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

Definition at line 129 of file PSEUDO_F32vec4.h.

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

◆ 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)

Definition at line 90 of file PSEUDO_F32vec4.h.

References _op.

90  { _op(a, b, ||) }
91 
92  friend F32vec4 operator!(const F32vec4 &a)
93  {
94  F32vec4 z;
95  z[0] = !a[0];
96  z[1] = !a[1];
97  z[2] = !a[2];
98  z[3] = !a[3];
99 
#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 76 of file PSEUDO_F32vec4.h.

References _op.

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

◆ operator+()

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

Definition at line 74 of file PSEUDO_F32vec4.h.

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

◆ operator-()

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

Definition at line 75 of file PSEUDO_F32vec4.h.

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

◆ operator/()

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

Definition at line 77 of file PSEUDO_F32vec4.h.

References _op.

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

◆ operator<()

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

Definition at line 80 of file PSEUDO_F32vec4.h.

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

◆ operator<<()

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

Definition at line 149 of file PSEUDO_F32vec4.h.

152  {
153  strm << a[0] << " " << a[1] << " " << a[2] << " " << a[3];

◆ operator<=()

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

Definition at line 81 of file PSEUDO_F32vec4.h.

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

◆ operator>()

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

Definition at line 82 of file PSEUDO_F32vec4.h.

References _op.

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

◆ operator>=()

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

Definition at line 83 of file PSEUDO_F32vec4.h.

References _op.

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

◆ operator>>()

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

Definition at line 155 of file PSEUDO_F32vec4.h.

158  {
159  float tmp;
160  strm >> tmp;
161  a = tmp;

◆ operator[]()

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

Definition at line 24 of file PSEUDO_F32vec4.h.

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

◆ 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 88 of file PSEUDO_F32vec4.h.

References _op.

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

◆ rcp() [1/2]

float rcp ( float  x)

Definition at line 126 of file PSEUDO_F32vec4.h.

References F32vec4::fabs.

126 { 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 134 of file PSEUDO_F32vec4.h.

References _f1, and F32vec4::sqrt.

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

◆ rsqrt() [1/2]

float rsqrt ( float  x)

Definition at line 125 of file PSEUDO_F32vec4.h.

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

◆ rsqrt() [2/2]

friend F32vec4 __attribute__::rsqrt ( const F32vec4 a)

Definition at line 133 of file PSEUDO_F32vec4.h.

References _f2, and F32vec4::asgnb.

133 { _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 127 of file PSEUDO_F32vec4.h.

References F32vec4::sqrt.

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

◆ sgn() [2/2]

friend F32vec4 __attribute__::sgn ( const F32vec4 a)

Definition at line 136 of file PSEUDO_F32vec4.h.

References _f1, and F32vec4::rcp.

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

◆ sin()

friend F32vec4 __attribute__::sin ( const F32vec4 a)

Definition at line 139 of file PSEUDO_F32vec4.h.

References _f1, and F32vec4::exp.

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

◆ sqrt()

friend F32vec4 __attribute__::sqrt ( const F32vec4 a)

Definition at line 132 of file PSEUDO_F32vec4.h.

References _f2, and F32vec4::max.

132 { _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 170 of file PSEUDO_F32vec4.h.

◆ v

float v[4]

Definition at line 22 of file PSEUDO_F32vec4.h.