1 // Copyright (c) 2010-2011  GeometryFactory Sarl (France)
2 //
3 // This file is part of CGAL (www.cgal.org)
4 //
5 // $URL: https://github.com/CGAL/cgal/blob/v5.3/Number_types/include/CGAL/FPU_gcc_i386_sse2.h $
6 // $Id: FPU_gcc_i386_sse2.h 0779373 2020-03-26T13:31:46+01:00 Sébastien Loriot
7 // SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-Commercial
8 //
9 //
10 // Author(s)     : Laurent Rineau
11 
12 extern "C" {
13 #include <fenv.h>
14 }
15 
16 namespace CGAL {
17 
18 // replacement for C99
19 
20 inline int
feclearexcept(int exceptions)21 feclearexcept(int exceptions) {
22     int mxcsr;
23     asm volatile("stmxcsr %0" : "=m" (mxcsr) );
24     mxcsr &= ~exceptions;
25     asm volatile("ldmxcsr %0" : : "m" (mxcsr) );
26     return 0;
27 }
28 
29 inline int
fetestexcept(int exceptions)30 fetestexcept(int exceptions) {
31     int status;
32     asm volatile("stmxcsr %0" : "=m" (status) );
33     return status & exceptions;
34 }
35 
36 } // end namespace CGAL
37