| 1 |
/* { dg-do compile } */ |
| 2 |
/* { dg-require-effective-target ilp32 } */ |
| 3 |
/* { dg-options "-O2 -ftree-tail-merge" } */ |
| 4 |
|
| 5 |
class v2d { |
| 6 |
public: |
| 7 |
double x; |
| 8 |
double y; |
| 9 |
}; |
| 10 |
|
| 11 |
class v3d { |
| 12 |
public: |
| 13 |
double x; |
| 14 |
v3d() {} |
| 15 |
v3d(const v2d & cr2Dv) {} |
| 16 |
}; |
| 17 |
|
| 18 |
class e2d { |
| 19 |
protected: |
| 20 |
v2d _Min; |
| 21 |
v2d _Max; |
| 22 |
public: |
| 23 |
int cop2d(const v2d & rPnt) const; |
| 24 |
v2d clp2d(const v2d & rPnt) const; |
| 25 |
}; |
| 26 |
|
| 27 |
inline int e2d::cop2d(const v2d & rPnt) const { |
| 28 |
int bRet = 1; |
| 29 |
if (rPnt.x < _Min.x) bRet = 0; |
| 30 |
else if (rPnt.x > _Max.x) bRet = 0; |
| 31 |
else if (rPnt.y > _Max.y) bRet = 0; |
| 32 |
return bRet; |
| 33 |
} |
| 34 |
|
| 35 |
inline v2d e2d::clp2d(const v2d & rPnt) const { |
| 36 |
v2d sRet = rPnt; |
| 37 |
if (rPnt.x < _Min.x) sRet.x = _Min.x; |
| 38 |
if (rPnt.y < _Min.y) sRet.y = _Min.y; |
| 39 |
if (rPnt.x > _Max.x) sRet.x = _Max.x; |
| 40 |
if (rPnt.y > _Max.y) sRet.y = _Max.y; |
| 41 |
return sRet; |
| 42 |
} |
| 43 |
|
| 44 |
class sExt { |
| 45 |
protected: |
| 46 |
e2d _Dom; |
| 47 |
long eval() const; |
| 48 |
long evalPoint(const v2d & crUV, v3d & rPnt) const; |
| 49 |
}; |
| 50 |
|
| 51 |
long sExt::evalPoint(const v2d & crUV, v3d & rPnt) const { |
| 52 |
v3d sUV = crUV; |
| 53 |
if (!_Dom.cop2d(crUV)) { |
| 54 |
sUV = _Dom.clp2d(crUV); |
| 55 |
} |
| 56 |
return eval(); |
| 57 |
} |