/usr/include/osl/container/quadInt.h is in libosl-dev 0.6.0-3.1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 | /* quadInt.h
*/
#ifndef EVAL_CONTAINER_QUAD_INT_H
#define EVAL_CONTAINER_QUAD_INT_H
#include "osl/config.h"
#include "osl/misc/carray.h"
#include "osl/misc/align16New.h"
#ifdef __INTEL_COMPILER
# include <emmintrin.h>
# define __builtin_ia32_pxor128 _mm_xor_pd
# define __builtin_ia32_psubd128 _mm_sub_epi32
# define __builtin_ia32_paddd128 _mm_add_epi32
#endif
#ifndef OSL_NO_SSE
#if (defined __x86_64__) || (defined __i386__)
# ifndef OSL_USE_SSE
# define OSL_USE_SSE 1
# endif
#else
# warning "QuadInt without SSE"
#endif
#endif
namespace osl
{
namespace container
{
#ifdef OSL_USE_SSE
# ifdef __INTEL_COMPILER
typedef __v4si v4si;
typedef __v2di v2di;
# else
typedef int v4si __attribute__ ((vector_size (16)));
typedef long long v2di __attribute__ ((vector_size (16)));
# endif
#endif
struct QuadInt : public misc::Align16New
{
union XMM{
CArray<int,4> iv;
CArray<long long,2> llv;
#ifdef OSL_USE_SSE
v4si v4;
v2di v2;
#endif
} v
#ifdef OSL_USE_SSE
__attribute__((aligned(16)))
#endif
;
QuadInt(){
clear();
}
QuadInt(QuadInt const& si){
#if OSL_USE_SSE
v.v4=si.v.v4;
#else
v.llv = si.v.llv;
#endif
}
QuadInt& operator=(QuadInt const& si)
{
#if OSL_USE_SSE
v.v4=si.v.v4;
#else
v.llv = si.v.llv;
#endif
return *this;
}
void clear()
{
#if OSL_USE_SSE
v.v4=(v4si){ 0, 0, 0, 0 };
#else
v.llv[0] = v.llv[1] = 0;
#endif
}
int& operator[](int i) {
return v.iv[i];
}
const int& operator[](int i) const {
return v.iv[i];
}
QuadInt operator-() const{
QuadInt ret;
ret -= *this;
return ret;
}
QuadInt& operator+=(QuadInt const& si){
#if OSL_USE_SSE
v.v4=__builtin_ia32_paddd128(v.v4,si.v.v4);
#else
for(int i=0;i<4;i++) v.iv[i]+=si.v.iv[i];
#endif
return *this;
}
QuadInt& operator-=(QuadInt const& si){
#if OSL_USE_SSE
v.v4=__builtin_ia32_psubd128(v.v4,si.v.v4);
#else
for(int i=0;i<4;i++) v.iv[i]-=si.v.iv[i];
#endif
return *this;
}
QuadInt& operator*=(int scale){
#if OSL_USE_SSE41
XMM val;
unsigned long long scalescale=(unsigned long long )((unsigned int)scale);
scalescale|=scalescale<<32ull;
val.v2=__builtin_ia32_vec_set_v2di(val.v2,(long long)scalescale,0);
val.v2=__builtin_ia32_vec_set_v2di(val.v2,(long long)scalescale,1);
v.v4=__builtin_ia32_pmulld128(v.v4,val.v4);
#else
for(int i=0;i<4;i++) v.iv[i]*=scale;
#endif
return *this;
}
static size_t size() { return 4; }
};
inline QuadInt operator+(QuadInt const& si0,QuadInt const& si1)
{
QuadInt ret(si0);
ret+=si1;
return ret;
}
inline QuadInt operator-(QuadInt const& si0,QuadInt const& si1)
{
QuadInt ret(si0);
ret-=si1;
return ret;
}
inline QuadInt operator*(QuadInt const& si0,int scale)
{
QuadInt ret(si0);
ret*=scale;
return ret;
}
inline bool operator==(QuadInt const& l,QuadInt const& r)
{
return l.v.llv[0] == r.v.llv[0] && l.v.llv[1] == r.v.llv[1];
}
inline bool operator<(QuadInt const& l,QuadInt const& r)
{
if (l.v.llv[0] != r.v.llv[0])
return (l.v.llv[0] < r.v.llv[0]);
return l.v.llv[1] < r.v.llv[1];
}
class QuadIntPair
{
CArray<QuadInt,2> v;
public:
QuadIntPair() {}
const QuadInt& operator[](int i) const{
return v[i];
}
const QuadInt& operator[](Player pl) const{
return v[pl];
}
QuadInt& operator[](int i){
return v[i];
}
QuadInt& operator[](Player pl){
return v[pl];
}
QuadIntPair& operator+=(QuadIntPair const& a){
v[0]+=a.v[0];
v[1]+=a.v[1];
return *this;
}
QuadIntPair& operator-=(QuadIntPair const& a){
v[0]-=a.v[0];
v[1]-=a.v[1];
return *this;
}
};
inline QuadIntPair operator+(QuadIntPair const& si0,QuadIntPair const& si1)
{
QuadIntPair ret(si0);
ret+=si1;
return ret;
}
inline QuadIntPair operator-(QuadIntPair const& si0,QuadIntPair const& si1)
{
QuadIntPair ret(si0);
ret-=si1;
return ret;
}
inline bool operator==(QuadIntPair const& l,QuadIntPair const& r)
{
return l[0] == r[0] && l[1] == r[1];
}
}
using container::QuadInt;
using container::QuadIntPair;
}
#endif // EVAL_CONTAINER_QUAD_INT_H
// ;;; Local Variables:
// ;;; mode:c++
// ;;; c-basic-offset:2
// ;;; End:
|