"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "splash/SplashMath.h" between
xpdf-4.01.01.tar.gz and xpdf-4.02.tar.gz

About: Xpdf is a PDF viewer for X.

SplashMath.h  (xpdf-4.01.01):SplashMath.h  (xpdf-4.02)
skipping to change at line 50 skipping to change at line 50
return FixedPoint::floor(x); return FixedPoint::floor(x);
#elif (defined(__GNUC__) && defined(__SSE2__)) || \ #elif (defined(__GNUC__) && defined(__SSE2__)) || \
(defined(_WIN32) && (_M_IX86_FP == 2 || defined(_M_X64))) (defined(_WIN32) && (_M_IX86_FP == 2 || defined(_M_X64)))
//--- SSE2 intrinsics //--- SSE2 intrinsics
// NB: 64-bit x86 guarantees availability of SSE2. // NB: 64-bit x86 guarantees availability of SSE2.
__m128d m1, m2; __m128d m1, m2;
__m128i m3; int i, s;
int s, i;
m1 = _mm_set_sd(x); // m1 = x m1 = _mm_set_sd(x);
i = _mm_cvttsd_si32(m1); // i = trunc(x) i = _mm_cvttsd_si32(m1);
m2 = _mm_cvtsi32_sd(m1, i); // m2 = (double)trunc(x) m2 = _mm_cvtsi32_sd(m1, i);
m1 = _mm_sub_sd(m1, m2); // m1 = x - trunc(x) s = _mm_ucomigt_sd(m2, m1);
m3 = _mm_castpd_si128(m1); // m3 = m1 (as 64-bit int) return i - s;
m3 = _mm_srli_epi64(m3, 63); // m3 = m3 >> 63
s = _mm_cvtsi128_si32(m3); // s = m3 = sign bit of x - trunc(x)
return i - s; // trunc(x) - sign bit
#elif defined(__GNUC__) && defined(__i386__) && !defined(__APPLE__) #elif defined(__GNUC__) && defined(__i386__) && !defined(__APPLE__)
//--- x87 inline assembly (gcc/clang) //--- x87 inline assembly (gcc/clang)
// (this code fails on OSX for reasons I don't understand) // (this code fails on OSX for reasons I don't understand)
Gushort oldCW, newCW, t; Gushort oldCW, newCW, t;
int result; int result;
__asm__ volatile("fnstcw %0\n" __asm__ volatile("fnstcw %0\n"
skipping to change at line 126 skipping to change at line 122
return FixedPoint::ceil(x); return FixedPoint::ceil(x);
#elif (defined(__GNUC__) && defined(__SSE2__)) || \ #elif (defined(__GNUC__) && defined(__SSE2__)) || \
(defined(_WIN32) && (_M_IX86_FP == 2 || defined(_M_X64))) (defined(_WIN32) && (_M_IX86_FP == 2 || defined(_M_X64)))
//--- SSE2 intrinsics //--- SSE2 intrinsics
// NB: 64-bit x86 guarantees availability of SSE2. // NB: 64-bit x86 guarantees availability of SSE2.
__m128d m1, m2; __m128d m1, m2;
__m128i m3; int i, s;
int s, i;
m1 = _mm_set_sd(x); // m1 = x m1 = _mm_set_sd(x);
i = _mm_cvttsd_si32(m1); // i = trunc(x) i = _mm_cvttsd_si32(m1);
m2 = _mm_cvtsi32_sd(m1, i); // m2 = (double)trunc(x) m2 = _mm_cvtsi32_sd(m1, i);
m2 = _mm_sub_sd(m2, m1); // m2 = trunc(x) - x s = _mm_ucomilt_sd(m2, m1);
m3 = _mm_castpd_si128(m2); // m3 = m2 (as 64-bit int) return i + s;
m3 = _mm_srli_epi64(m3, 63); // m3 = m3 >> 63
s = _mm_cvtsi128_si32(m3); // s = m3 = sign bit of x - trunc(x)
return i + s; // trunc(x) + sign bit
#elif defined(__GNUC__) && defined(__i386__) && !defined(__APPLE__) #elif defined(__GNUC__) && defined(__i386__) && !defined(__APPLE__)
//--- x87 inline assembly (gcc/clang) //--- x87 inline assembly (gcc/clang)
// (this code fails on OSX for reasons I don't understand) // (this code fails on OSX for reasons I don't understand)
Gushort oldCW, newCW, t; Gushort oldCW, newCW, t;
int result; int result;
__asm__ volatile("fnstcw %0\n" __asm__ volatile("fnstcw %0\n"
skipping to change at line 318 skipping to change at line 310
// If w >= 0 and strokeAdjMode is splashStrokeAdjustCAD then a special // If w >= 0 and strokeAdjMode is splashStrokeAdjustCAD then a special
// mode for projecting line caps is enabled, with w being the // mode for projecting line caps is enabled, with w being the
// transformed line width. // transformed line width.
static inline void splashStrokeAdjust(SplashCoord xMin, SplashCoord xMax, static inline void splashStrokeAdjust(SplashCoord xMin, SplashCoord xMax,
int *xMinI, int *xMaxI, int *xMinI, int *xMaxI,
SplashStrokeAdjustMode strokeAdjMode, SplashStrokeAdjustMode strokeAdjMode,
SplashCoord w = -1) { SplashCoord w = -1) {
int x0, x1; int x0, x1;
// make sure the coords fit in 32-bit ints
#if USE_FIXEDPOINT
if (xMin < -32767) {
xMin = -32767;
} else if (xMin > 32767) {
xMin = 32767;
}
if (xMax < -32767) {
xMax = -32767;
} else if (xMax > 32767) {
xMax = 32767;
}
#else
if (xMin < -1e9) {
xMin = -1e9;
} else if (xMin > 1e9) {
xMin = 1e9;
}
if (xMax < -1e9) {
xMax = -1e9;
} else if (xMax > 1e9) {
xMax = 1e9;
}
#endif
// this will never be called with strokeAdjMode == splashStrokeAdjustOff // this will never be called with strokeAdjMode == splashStrokeAdjustOff
if (strokeAdjMode == splashStrokeAdjustCAD) { if (strokeAdjMode == splashStrokeAdjustCAD) {
x0 = splashRound(xMin); x0 = splashRound(xMin);
if (w >= 0) { if (w >= 0) {
x1 = splashRound(xMax - w) + splashRound(w); x1 = splashRound(xMax - w) + splashRound(w);
} else { } else {
x1 = x0 + splashRound(xMax - xMin); x1 = x0 + splashRound(xMax - xMin);
} }
} else { } else {
// NB: enable exactly one of these. // NB: enable exactly one of these.
 End of changes. 5 change blocks. 
20 lines changed or deleted 37 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)