summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Gray <jsg@cvs.openbsd.org>2017-02-04 02:35:02 +0000
committerJonathan Gray <jsg@cvs.openbsd.org>2017-02-04 02:35:02 +0000
commit7768f5f5b11b0093d620cb7c6fe6bcd6e5254431 (patch)
tree2782c9e5e097633ae417d25f37076feb8885c19f
parent34cb70dfe29c505d181c4e21956fed38c0c0fbaa (diff)
Bring in some changes from xlock 5.50 to prevent clang from erroring
out on ambiguous overloaded operators. ok matthieu@
-rw-r--r--app/xlockmore/modes/glx/i_figureeight.cc2
-rw-r--r--app/xlockmore/modes/glx/i_sphere.cc14
-rw-r--r--app/xlockmore/modes/glx/i_threejetvec.cc10
-rw-r--r--app/xlockmore/modes/glx/i_twojetvec.cc10
4 files changed, 18 insertions, 18 deletions
diff --git a/app/xlockmore/modes/glx/i_figureeight.cc b/app/xlockmore/modes/glx/i_figureeight.cc
index 38ac2cdc9..d0fda3f40 100644
--- a/app/xlockmore/modes/glx/i_figureeight.cc
+++ b/app/xlockmore/modes/glx/i_figureeight.cc
@@ -28,7 +28,7 @@ TwoJetVec AddFigureEight(ThreeJetVec p, ThreeJet u, TwoJet v, ThreeJet form, Thr
TwoJetVec w = Normalize(Cross(h, du))*(TwoJet(size)*1.1);
return RotateZ(
TwoJetVec(p) +
- FigureEight(w, h, du*D(size, 0)*(D(u, 0)^(-1)), form, v),
+ FigureEight(w, h, du*D(size, 0)*(D(u, 0)^((double)-1)), form, v),
v*(1./n_strips)
);
}
diff --git a/app/xlockmore/modes/glx/i_sphere.cc b/app/xlockmore/modes/glx/i_sphere.cc
index d3a838dbf..7c7bda04f 100644
--- a/app/xlockmore/modes/glx/i_sphere.cc
+++ b/app/xlockmore/modes/glx/i_sphere.cc
@@ -28,16 +28,16 @@ ThreeJet Param1(ThreeJet x) {
double offset = 0;
x %= 4;
if (x > 2) { x = x+(-2); offset = 2; }
- if (x <= 1) return x*2 + (x^2)*(-1) + offset;
- else return (x^2) + x*(-2) + (2 + offset);
+ if (x <= 1) return x*2 + (x^(double)2)*(-1) + offset;
+ else return (x^(double)2) + x*(-2) + (2 + offset);
}
ThreeJet Param2(ThreeJet x) {
double offset = 0;
x %= 4;
if (x > 2) { x = x+(-2); offset = 2; }
- if (x <= 1) return (x^2) + offset;
- else return (x^2)*(-1) + x*4 + (-2 + offset);
+ if (x <= 1) return (x^(double)2) + offset;
+ else return (x^(double)2)*(-1) + x*4 + (-2 + offset);
}
static inline ThreeJet TInterp(double x) {
@@ -48,7 +48,7 @@ ThreeJet UInterp(ThreeJet x) {
x %= 2;
if (x > 1)
x = x*(-1) + 2;
- return (x^2)*3 + (x^3) * (-2);
+ return (x^(double)2)*3 + (x^(double)3) * (-2);
}
#define FFPOW 3
@@ -59,7 +59,7 @@ ThreeJet FFInterp(ThreeJet x) {
x = x*1.06 + -0.05;
if (x < 0) return ThreeJet(0, 0, 0);
else if (x > 1) return ThreeJet(0, 0, 0) + 1;
- else return (x ^ (FFPOW-1)) * (FFPOW) + (x^FFPOW) * (-FFPOW+1);
+ else return (x ^ (double)(FFPOW-1)) * (FFPOW) + (x^(double)FFPOW) * (-FFPOW+1);
}
#define FSPOW 3
@@ -67,7 +67,7 @@ ThreeJet FSInterp(ThreeJet x) {
x %= 2;
if (x > 1)
x = x*(-1) + 2;
- return ((x ^ (FSPOW-1)) * (FSPOW) + (x^FSPOW) * (-FSPOW+1)) * (-0.2);
+ return ((x ^ (double)(FSPOW-1)) * (FSPOW) + (x^(double)FSPOW) * (-FSPOW+1)) * (-0.2);
}
ThreeJetVec Stage0(ThreeJet u, ThreeJet v) {
diff --git a/app/xlockmore/modes/glx/i_threejetvec.cc b/app/xlockmore/modes/glx/i_threejetvec.cc
index 9cfcf3513..8ff4bd84b 100644
--- a/app/xlockmore/modes/glx/i_threejetvec.cc
+++ b/app/xlockmore/modes/glx/i_threejetvec.cc
@@ -63,10 +63,10 @@ ThreeJetVec Normalize(ThreeJetVec v) {
ThreeJetVec RotateZ(ThreeJetVec v, ThreeJet angle) {
ThreeJetVec result;
- ThreeJet s,c;
+ ThreeJet s, c;
s = Sin (angle);
c = Cos (angle);
- result.x = v.x*c + v.y*s;
+ result.x = v.x*c + v.y*s;
result.y = v.x*s*-1 + v.y*c;
result.z = v.z;
return result;
@@ -79,13 +79,13 @@ ThreeJetVec RotateY(ThreeJetVec v, ThreeJet angle) {
c = Cos (angle);
result.x = v.x*c + v.z*s*-1;
result.y = v.y;
- result.z = v.x*s + v.z*c ;
+ result.z = v.x*s + v.z*c;
return result;
}
ThreeJetVec RotateX(ThreeJetVec v, ThreeJet angle) {
ThreeJetVec result;
- ThreeJet s,c;
+ ThreeJet s, c;
s = Sin (angle);
c = Cos (angle);
result.x = v.x;
@@ -100,5 +100,5 @@ ThreeJetVec InterpolateVec(ThreeJetVec v1, ThreeJetVec v2, ThreeJet weight) {
ThreeJet Length(ThreeJetVec v)
{
- return (v.x^2 + v.y^2) ^ (.5);
+ return (v.x * v.x + v.y * v.y) ^ (.5);
}
diff --git a/app/xlockmore/modes/glx/i_twojetvec.cc b/app/xlockmore/modes/glx/i_twojetvec.cc
index 48e05b00a..fe767f8b7 100644
--- a/app/xlockmore/modes/glx/i_twojetvec.cc
+++ b/app/xlockmore/modes/glx/i_twojetvec.cc
@@ -55,10 +55,10 @@ TwoJetVec Normalize(TwoJetVec v) {
TwoJetVec RotateZ(TwoJetVec v, TwoJet angle) {
TwoJetVec result;
- TwoJet s,c;
+ TwoJet s, c;
s = Sin (angle);
c = Cos (angle);
- result.x = v.x*c + v.y*s;
+ result.x = v.x*c + v.y*s;
result.y = v.x*s*-1 + v.y*c;
result.z = v.z;
return result;
@@ -71,13 +71,13 @@ TwoJetVec RotateY(TwoJetVec v, TwoJet angle) {
c = Cos (angle);
result.x = v.x*c + v.z*s*-1;
result.y = v.y;
- result.z = v.x*s + v.z*c ;
+ result.z = v.x*s + v.z*c;
return result;
}
TwoJetVec RotateX(TwoJetVec v, TwoJet angle) {
TwoJetVec result;
- TwoJet s,c;
+ TwoJet s, c;
s = Sin (angle);
c = Cos (angle);
result.x = v.x;
@@ -92,5 +92,5 @@ TwoJetVec InterpolateVec(TwoJetVec v1, TwoJetVec v2, TwoJet weight) {
TwoJet Length(TwoJetVec v)
{
- return (v.x^2 + v.y^2) ^ (.5);
+ return (v.x * v.x + v.y * v.y) ^ (.5);
}