Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 635006 | Differences between
and this patch

Collapse All | Expand All

(-)file_not_specified_in_diff (-1 / +80 lines)
Line  Link Here
0
-- bitcoin-0.13.1-cxx11/src/test/test_bitcoin.cpp
0
++ bitcoin-0.13.1-uclibc/src/test/test_bitcoin.cpp
Lines 158-160 bool ShutdownRequested() Link Here
158
{
158
{
159
  return false;
159
  return false;
160
}
160
}
161
162
int main(int argc, char** argv)
163
{
164
	new TestChain100Setup();
165
	return 0;
166
}
167
168
169
#ifdef __UCLIBC__
170
#if defined __i386__ || defined __amd64__
171
#include <fenv.h>
172
#include <x86intrin.h>
173
174
#define	_SSE_MASK_SHIFT 7
175
176
static inline unsigned short get_x87_sw(void)
177
{
178
	unsigned short sw;
179
	__asm__("fnstsw %0" : "=a"(sw));
180
	return sw;
181
}
182
183
int feclearexcept(int mask)
184
{
185
	unsigned short sw = get_x87_sw();
186
	if (sw & mask & FE_ALL_EXCEPT) {
187
        	__asm__("fnclex");
188
	}
189
	unsigned int mxcsr = _mm_getcsr();
190
	mxcsr |= sw & FE_ALL_EXCEPT;
191
	if (mxcsr & mask & FE_ALL_EXCEPT) {
192
		_mm_setcsr(mxcsr & ~(mask & FE_ALL_EXCEPT));
193
	}
194
	return 0;
195
}
196
197
int feenableexcept(int mask)
198
{
199
	unsigned int mxcsr, omask;
200
	unsigned short control;
201
202
	mask &= FE_ALL_EXCEPT;
203
204
	__asm__ volatile ("fnstcw %0" : "=m" (control));
205
	__asm__ volatile ("stmxcsr %0" : "=m" (mxcsr));
206
207
	omask = ~(control | (mxcsr >> _SSE_MASK_SHIFT)) & FE_ALL_EXCEPT;
208
	control &= ~mask;
209
	__asm__ volatile ("fldcw %0" : : "m" (control));
210
211
	mxcsr &= ~(mask << _SSE_MASK_SHIFT);
212
	__asm__ volatile ("ldmxcsr %0" : : "m" (mxcsr));
213
214
	return (omask);
215
}
216
217
int fedisableexcept(int mask)
218
{
219
	unsigned int mxcsr, omask;
220
	unsigned short control;
221
222
	mask &= FE_ALL_EXCEPT;
223
224
	__asm__ volatile ("fnstcw %0" : "=m" (control));
225
	__asm__ volatile ("stmxcsr %0" : "=m" (mxcsr));
226
227
	omask = ~(control | (mxcsr >> _SSE_MASK_SHIFT)) & FE_ALL_EXCEPT;
228
	control |= mask;
229
	__asm__ volatile ("fldcw %0" : : "m" (control));
230
231
	mxcsr |= mask << _SSE_MASK_SHIFT;
232
	__asm__ volatile ("ldmxcsr %0" : : "m" (mxcsr));
233
234
	return (omask);
235
}
236
#else
237
#error Only IA32 and AMD64 architectures are supported for fe*except
238
#endif
239
#endif

Return to bug 635006