mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 15:52:57 +00:00
Git conversion: Make reactos the root directory, move rosapps, rostests, wallpapers into modules, and delete rossubsys.
This commit is contained in:
parent
b94e2d8ca0
commit
c2c66aff7d
24198 changed files with 0 additions and 37285 deletions
15
sdk/lib/crt/float/amd64/clearfp.S
Normal file
15
sdk/lib/crt/float/amd64/clearfp.S
Normal file
|
@ -0,0 +1,15 @@
|
|||
|
||||
|
||||
|
||||
#include <asm.inc>
|
||||
|
||||
.code64
|
||||
|
||||
PUBLIC _clearfp
|
||||
FUNC _clearfp
|
||||
.ENDPROLOG
|
||||
fnclex
|
||||
|
||||
ENDFUNC
|
||||
|
||||
END
|
11
sdk/lib/crt/float/amd64/fpreset.S
Normal file
11
sdk/lib/crt/float/amd64/fpreset.S
Normal file
|
@ -0,0 +1,11 @@
|
|||
|
||||
#include <asm.inc>
|
||||
|
||||
.code64
|
||||
|
||||
FUNC _fpreset
|
||||
.endprolog
|
||||
fninit
|
||||
ENDFUNC
|
||||
|
||||
END
|
24
sdk/lib/crt/float/amd64/getsetfpcw.S
Normal file
24
sdk/lib/crt/float/amd64/getsetfpcw.S
Normal file
|
@ -0,0 +1,24 @@
|
|||
|
||||
#include <asm.inc>
|
||||
|
||||
.code64
|
||||
|
||||
PUBLIC __getfpcw87
|
||||
FUNC __getfpcw87
|
||||
sub rsp, 8
|
||||
.ENDPROLOG
|
||||
stmxcsr [rsp]
|
||||
mov rax, [rsp]
|
||||
add rsp, 8
|
||||
ret
|
||||
ENDFUNC
|
||||
|
||||
PUBLIC __setfpcw87
|
||||
FUNC __setfpcw87
|
||||
mov qword ptr [rsp + 8], rcx
|
||||
.ENDPROLOG
|
||||
ldmxcsr [rsp + 8]
|
||||
ret
|
||||
ENDFUNC
|
||||
|
||||
END
|
16
sdk/lib/crt/float/amd64/logb.S
Normal file
16
sdk/lib/crt/float/amd64/logb.S
Normal file
|
@ -0,0 +1,16 @@
|
|||
|
||||
|
||||
#include <asm.inc>
|
||||
|
||||
.code64
|
||||
|
||||
FUNC _logb
|
||||
.endprolog
|
||||
|
||||
fld dword ptr [rsp + 8]
|
||||
fxtract
|
||||
fstp st
|
||||
ret
|
||||
ENDFUNC
|
||||
|
||||
END
|
24
sdk/lib/crt/float/arm/_clearfp.s
Normal file
24
sdk/lib/crt/float/arm/_clearfp.s
Normal file
|
@ -0,0 +1,24 @@
|
|||
/*
|
||||
* COPYRIGHT: BSD - See COPYING.ARM in the top level directory
|
||||
* PROJECT: ReactOS CRT library
|
||||
* PURPOSE: Implementation of _clearfp
|
||||
* PROGRAMMER: Timo Kreuzer (timo.kreuzer@reactos.org)
|
||||
*/
|
||||
|
||||
/* INCLUDES ******************************************************************/
|
||||
|
||||
#include <kxarm.h>
|
||||
|
||||
/* CODE **********************************************************************/
|
||||
|
||||
TEXTAREA
|
||||
|
||||
LEAF_ENTRY _clearfp
|
||||
|
||||
__assertfail
|
||||
bx lr
|
||||
|
||||
LEAF_END _clearfp
|
||||
|
||||
END
|
||||
/* EOF */
|
24
sdk/lib/crt/float/arm/_controlfp.s
Normal file
24
sdk/lib/crt/float/arm/_controlfp.s
Normal file
|
@ -0,0 +1,24 @@
|
|||
/*
|
||||
* COPYRIGHT: BSD - See COPYING.ARM in the top level directory
|
||||
* PROJECT: ReactOS CRT library
|
||||
* PURPOSE: Implementation of _controlfp
|
||||
* PROGRAMMER: Timo Kreuzer (timo.kreuzer@reactos.org)
|
||||
*/
|
||||
|
||||
/* INCLUDES ******************************************************************/
|
||||
|
||||
#include <kxarm.h>
|
||||
|
||||
/* CODE **********************************************************************/
|
||||
|
||||
TEXTAREA
|
||||
|
||||
LEAF_ENTRY _controlfp
|
||||
|
||||
__assertfail
|
||||
bx lr
|
||||
|
||||
LEAF_END _controlfp
|
||||
|
||||
END
|
||||
/* EOF */
|
24
sdk/lib/crt/float/arm/_fpreset.s
Normal file
24
sdk/lib/crt/float/arm/_fpreset.s
Normal file
|
@ -0,0 +1,24 @@
|
|||
/*
|
||||
* COPYRIGHT: BSD - See COPYING.ARM in the top level directory
|
||||
* PROJECT: ReactOS CRT library
|
||||
* PURPOSE: Implementation of _fpreset
|
||||
* PROGRAMMER: Timo Kreuzer (timo.kreuzer@reactos.org)
|
||||
*/
|
||||
|
||||
/* INCLUDES ******************************************************************/
|
||||
|
||||
#include <kxarm.h>
|
||||
|
||||
/* CODE **********************************************************************/
|
||||
|
||||
TEXTAREA
|
||||
|
||||
LEAF_ENTRY _fpreset
|
||||
|
||||
__assertfail
|
||||
bx lr
|
||||
|
||||
LEAF_END _fpreset
|
||||
|
||||
END
|
||||
/* EOF */
|
24
sdk/lib/crt/float/arm/_statusfp.s
Normal file
24
sdk/lib/crt/float/arm/_statusfp.s
Normal file
|
@ -0,0 +1,24 @@
|
|||
/*
|
||||
* COPYRIGHT: BSD - See COPYING.ARM in the top level directory
|
||||
* PROJECT: ReactOS CRT library
|
||||
* PURPOSE: Implementation of _statusfp
|
||||
* PROGRAMMER: Timo Kreuzer (timo.kreuzer@reactos.org)
|
||||
*/
|
||||
|
||||
/* INCLUDES ******************************************************************/
|
||||
|
||||
#include <kxarm.h>
|
||||
|
||||
/* CODE **********************************************************************/
|
||||
|
||||
TEXTAREA
|
||||
|
||||
LEAF_ENTRY _statusfp
|
||||
|
||||
__assertfail
|
||||
bx lr
|
||||
|
||||
LEAF_END _statusfp
|
||||
|
||||
END
|
||||
/* EOF */
|
33
sdk/lib/crt/float/chgsign.c
Normal file
33
sdk/lib/crt/float/chgsign.c
Normal file
|
@ -0,0 +1,33 @@
|
|||
/*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS system libraries
|
||||
* FILE: lib/sdk/crt/float/chgsign.c
|
||||
* PURPOSE: Unknown
|
||||
* PROGRAMER: Unknown
|
||||
* UPDATE HISTORY:
|
||||
* 25/11/05: Added license header
|
||||
*/
|
||||
|
||||
#include <precomp.h>
|
||||
|
||||
#include <internal/ieee.h>
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
double _chgsign( double __x )
|
||||
{
|
||||
union
|
||||
{
|
||||
double* __x;
|
||||
double_s *x;
|
||||
} u;
|
||||
u.__x = &__x;
|
||||
|
||||
if ( u.x->sign == 1 )
|
||||
u.x->sign = 0;
|
||||
else
|
||||
u.x->sign = 1;
|
||||
|
||||
return __x;
|
||||
}
|
36
sdk/lib/crt/float/copysign.c
Normal file
36
sdk/lib/crt/float/copysign.c
Normal file
|
@ -0,0 +1,36 @@
|
|||
/*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS system libraries
|
||||
* FILE: lib/sdk/crt/float/copysign.c
|
||||
* PURPOSE: Unknown
|
||||
* PROGRAMER: Unknown
|
||||
* UPDATE HISTORY:
|
||||
* 25/11/05: Added license header
|
||||
*/
|
||||
|
||||
#include <precomp.h>
|
||||
#include <internal/ieee.h>
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
double _copysign (double __d, double __s)
|
||||
{
|
||||
union
|
||||
{
|
||||
double* __d;
|
||||
double_s* d;
|
||||
} d;
|
||||
union
|
||||
{
|
||||
double* __s;
|
||||
double_s* s;
|
||||
} s;
|
||||
d.__d = &__d;
|
||||
s.__s = &__s;
|
||||
|
||||
d.d->sign = s.s->sign;
|
||||
|
||||
return __d;
|
||||
}
|
||||
|
58
sdk/lib/crt/float/fpclass.c
Normal file
58
sdk/lib/crt/float/fpclass.c
Normal file
|
@ -0,0 +1,58 @@
|
|||
/*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS system libraries
|
||||
* FILE: lib/sdk/crt/float/fpclass.c
|
||||
* PURPOSE: Floating-point classes
|
||||
* PROGRAMER: Pierre Schweitzer (pierre@reactos.org)
|
||||
* REFERENCE: http://babbage.cs.qc.cuny.edu/IEEE-754/References.xhtml
|
||||
*/
|
||||
|
||||
#include <precomp.h>
|
||||
#include <float.h>
|
||||
#include <internal/ieee.h>
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
int _fpclass(double __d)
|
||||
{
|
||||
union
|
||||
{
|
||||
double* __d;
|
||||
double_s* d;
|
||||
} d;
|
||||
d.__d = &__d;
|
||||
|
||||
|
||||
/* With 0x7ff, it can only be infinity or NaN */
|
||||
if (d.d->exponent == 0x7ff)
|
||||
{
|
||||
if (d.d->mantissah == 0 && d.d->mantissal == 0)
|
||||
{
|
||||
return (d.d->sign == 0) ? _FPCLASS_PINF : _FPCLASS_NINF;
|
||||
}
|
||||
/* Windows will never return Signaling NaN */
|
||||
else
|
||||
{
|
||||
return _FPCLASS_QNAN;
|
||||
}
|
||||
}
|
||||
|
||||
/* With 0, it can only be zero or denormalized number */
|
||||
if (d.d->exponent == 0)
|
||||
{
|
||||
if (d.d->mantissah == 0 && d.d->mantissal == 0)
|
||||
{
|
||||
return (d.d->sign == 0) ? _FPCLASS_PZ : _FPCLASS_NZ;
|
||||
}
|
||||
else
|
||||
{
|
||||
return (d.d->sign == 0) ? _FPCLASS_PD : _FPCLASS_ND;
|
||||
}
|
||||
}
|
||||
/* Only remain normalized numbers */
|
||||
else
|
||||
{
|
||||
return (d.d->sign == 0) ? _FPCLASS_PN : _FPCLASS_NN;
|
||||
}
|
||||
}
|
19
sdk/lib/crt/float/fpecode.c
Normal file
19
sdk/lib/crt/float/fpecode.c
Normal file
|
@ -0,0 +1,19 @@
|
|||
/*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS system libraries
|
||||
* FILE: lib/sdk/crt/float/fpecode.c
|
||||
* PURPOSE: Unknown
|
||||
* PROGRAMER: Unknown
|
||||
* UPDATE HISTORY:
|
||||
* 25/11/05: Added license header
|
||||
*/
|
||||
|
||||
#include <precomp.h>
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
int * __fpecode(void)
|
||||
{
|
||||
return &msvcrt_get_thread_data()->fpecode;
|
||||
}
|
28
sdk/lib/crt/float/i386/clearfp.c
Normal file
28
sdk/lib/crt/float/i386/clearfp.c
Normal file
|
@ -0,0 +1,28 @@
|
|||
/*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS system libraries
|
||||
* FILE: lib/sdk/crt/float/i386/clearfp.c
|
||||
* PURPOSE: Unknown
|
||||
* PROGRAMER: Unknown
|
||||
* UPDATE HISTORY:
|
||||
* 25/11/05: Added license header
|
||||
*/
|
||||
|
||||
#include <precomp.h>
|
||||
|
||||
unsigned int _statusfp( void );
|
||||
|
||||
/*********************************************************************
|
||||
* _clearfp (MSVCRT.@)
|
||||
*/
|
||||
unsigned int CDECL _clearfp(void)
|
||||
{
|
||||
unsigned int retVal = _statusfp();
|
||||
#if defined(__GNUC__)
|
||||
__asm__ __volatile__( "fnclex" );
|
||||
#else
|
||||
__asm fnclex;
|
||||
#endif
|
||||
return retVal;
|
||||
}
|
||||
|
137
sdk/lib/crt/float/i386/cntrlfp.c
Normal file
137
sdk/lib/crt/float/i386/cntrlfp.c
Normal file
|
@ -0,0 +1,137 @@
|
|||
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
|
||||
|
||||
#include <precomp.h>
|
||||
#include <float.h>
|
||||
|
||||
#define X87_CW_IM (1<<0) /* Invalid operation mask */
|
||||
#define X87_CW_DM (1<<1) /* Denormal operand mask */
|
||||
#define X87_CW_ZM (1<<2) /* Zero divide mask */
|
||||
#define X87_CW_OM (1<<3) /* Overflow mask */
|
||||
#define X87_CW_UM (1<<4) /* Underflow mask */
|
||||
#define X87_CW_PM (1<<5) /* Precision mask */
|
||||
|
||||
#define X87_CW_PC_MASK (3<<8) /* precision control mask */
|
||||
#define X87_CW_PC24 (0<<8) /* 24 bit precision */
|
||||
#define X87_CW_PC53 (2<<8) /* 53 bit precision */
|
||||
#define X87_CW_PC64 (3<<8) /* 64 bit precision */
|
||||
|
||||
#define X87_CW_RC_MASK (3<<10) /* rounding control mask */
|
||||
#define X87_CW_RC_NEAREST (0<<10) /* round to nearest */
|
||||
#define X87_CW_RC_DOWN (1<<10) /* round down */
|
||||
#define X87_CW_RC_UP (2<<10) /* round up */
|
||||
#define X87_CW_RC_ZERO (3<<10) /* round toward zero (chop) */
|
||||
|
||||
#define X87_CW_IC (1<<12) /* infinity control flag */
|
||||
|
||||
#ifdef _M_AMD64
|
||||
unsigned int __getfpcw87(void);
|
||||
void __setfpcw87(unsigned int);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
|
||||
unsigned int CDECL _controlfp(unsigned int newval, unsigned int mask)
|
||||
{
|
||||
return _control87( newval, mask & ~_EM_DENORMAL );
|
||||
}
|
||||
|
||||
/*********************************************************************
|
||||
* _control87 (MSVCRT.@)
|
||||
*/
|
||||
unsigned int CDECL _control87(unsigned int newval, unsigned int mask)
|
||||
{
|
||||
unsigned short fpword = 0;
|
||||
unsigned int flags = 0;
|
||||
|
||||
TRACE("(%08x, %08x): Called\n", newval, mask);
|
||||
|
||||
/* Get fp control word */
|
||||
#ifdef _M_AMD64
|
||||
fpword = __getfpcw87();
|
||||
#elif defined(__GNUC__)
|
||||
__asm__ __volatile__( "fstcw %0" : "=m" (fpword) : );
|
||||
#else
|
||||
__asm fstcw [fpword];
|
||||
#endif
|
||||
|
||||
TRACE("Control word before : %08x\n", fpword);
|
||||
|
||||
/* Convert into mask constants */
|
||||
if (fpword & 0x1) flags |= _EM_INVALID;
|
||||
if (fpword & 0x2) flags |= _EM_DENORMAL;
|
||||
if (fpword & 0x4) flags |= _EM_ZERODIVIDE;
|
||||
if (fpword & 0x8) flags |= _EM_OVERFLOW;
|
||||
if (fpword & 0x10) flags |= _EM_UNDERFLOW;
|
||||
if (fpword & 0x20) flags |= _EM_INEXACT;
|
||||
switch(fpword & 0xC00) {
|
||||
case 0xC00: flags |= _RC_UP|_RC_DOWN; break;
|
||||
case 0x800: flags |= _RC_UP; break;
|
||||
case 0x400: flags |= _RC_DOWN; break;
|
||||
}
|
||||
switch(fpword & 0x300) {
|
||||
case 0x0: flags |= _PC_24; break;
|
||||
case 0x200: flags |= _PC_53; break;
|
||||
case 0x300: flags |= _PC_64; break;
|
||||
}
|
||||
if (fpword & 0x1000) flags |= _IC_AFFINE;
|
||||
|
||||
/* Mask with parameters */
|
||||
flags = (flags & ~mask) | (newval & mask);
|
||||
|
||||
/* Convert (masked) value back to fp word */
|
||||
fpword = 0;
|
||||
if (flags & _EM_INVALID) fpword |= 0x1;
|
||||
if (flags & _EM_DENORMAL) fpword |= 0x2;
|
||||
if (flags & _EM_ZERODIVIDE) fpword |= 0x4;
|
||||
if (flags & _EM_OVERFLOW) fpword |= 0x8;
|
||||
if (flags & _EM_UNDERFLOW) fpword |= 0x10;
|
||||
if (flags & _EM_INEXACT) fpword |= 0x20;
|
||||
switch(flags & (_RC_UP | _RC_DOWN)) {
|
||||
case _RC_UP|_RC_DOWN: fpword |= 0xC00; break;
|
||||
case _RC_UP: fpword |= 0x800; break;
|
||||
case _RC_DOWN: fpword |= 0x400; break;
|
||||
}
|
||||
switch (flags & (_PC_24 | _PC_53)) {
|
||||
case _PC_64: fpword |= 0x300; break;
|
||||
case _PC_53: fpword |= 0x200; break;
|
||||
case _PC_24: fpword |= 0x0; break;
|
||||
}
|
||||
if (flags & _IC_AFFINE) fpword |= 0x1000;
|
||||
|
||||
TRACE("Control word after : %08x\n", fpword);
|
||||
|
||||
/* Put fp control word */
|
||||
#ifdef _M_AMD64
|
||||
__setfpcw87(fpword);
|
||||
#elif defined(__GNUC__)
|
||||
__asm__ __volatile__( "fldcw %0" : : "m" (fpword) );
|
||||
#else
|
||||
__asm fldcw [fpword];
|
||||
#endif
|
||||
|
||||
return flags;
|
||||
}
|
||||
|
||||
/*********************************************************************
|
||||
* _controlfp_s (MSVCRT.@)
|
||||
*/
|
||||
int CDECL _controlfp_s(unsigned int *cur, unsigned int newval, unsigned int mask)
|
||||
{
|
||||
#ifdef __i386__
|
||||
unsigned int val;
|
||||
|
||||
if (!MSVCRT_CHECK_PMT( !(newval & mask & ~(_MCW_EM | _MCW_IC | _MCW_RC | _MCW_PC | _MCW_DN))))
|
||||
{
|
||||
if (cur) *cur = _controlfp( 0, 0 ); /* retrieve it anyway */
|
||||
return EINVAL;
|
||||
}
|
||||
val = _controlfp( newval, mask );
|
||||
if (cur) *cur = val;
|
||||
return 0;
|
||||
#else
|
||||
FIXME(":Not Implemented!\n");
|
||||
return 0;
|
||||
#endif
|
||||
}
|
31
sdk/lib/crt/float/i386/fpreset.c
Normal file
31
sdk/lib/crt/float/i386/fpreset.c
Normal file
|
@ -0,0 +1,31 @@
|
|||
/*
|
||||
* COPYRIGHT: See COPYING.LIB in the top level directory
|
||||
* PROJECT: ReactOS system libraries
|
||||
* PURPOSE: Resets FPU state to the default
|
||||
* PROGRAMER: Thomas Faber <thomas.faber@reactos.org>
|
||||
*/
|
||||
|
||||
#include <precomp.h>
|
||||
|
||||
/*********************************************************************
|
||||
* _fpreset (MSVCRT.@)
|
||||
*/
|
||||
void CDECL _fpreset(void)
|
||||
{
|
||||
const unsigned short x86_cw = 0x27f;
|
||||
#ifdef _MSC_VER
|
||||
__asm { fninit }
|
||||
__asm { fldcw [x86_cw] }
|
||||
#else
|
||||
__asm__ __volatile__( "fninit; fldcw %0" : : "m" (x86_cw) );
|
||||
#endif
|
||||
if (IsProcessorFeaturePresent(PF_XMMI64_INSTRUCTIONS_AVAILABLE))
|
||||
{
|
||||
const unsigned long sse2_cw = 0x1f80;
|
||||
#ifdef _MSC_VER
|
||||
__asm { ldmxcsr [sse2_cw] }
|
||||
#else
|
||||
__asm__ __volatile__( "ldmxcsr %0" : : "m" (sse2_cw) );
|
||||
#endif
|
||||
}
|
||||
}
|
40
sdk/lib/crt/float/i386/logb.c
Normal file
40
sdk/lib/crt/float/i386/logb.c
Normal file
|
@ -0,0 +1,40 @@
|
|||
/* Math functions for i387.
|
||||
Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by John C. Bowman <bowman@ipp-garching.mpg.de>, 1995.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with the GNU C Library; if not, write to the Free
|
||||
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include <precomp.h>
|
||||
|
||||
double _logb (double __x)
|
||||
{
|
||||
register double __val;
|
||||
#ifdef __GNUC__
|
||||
register double __junk;
|
||||
__asm __volatile__
|
||||
("fxtract\n\t"
|
||||
: "=t" (__junk), "=u" (__val) : "0" (__x));
|
||||
#else
|
||||
#pragma message ("REVIEW ME")
|
||||
__asm fld [__x];
|
||||
__asm fxtract;
|
||||
__asm fstp st(0);
|
||||
__asm fstp [__val];
|
||||
#endif /*__GNUC__*/
|
||||
return __val;
|
||||
}
|
44
sdk/lib/crt/float/i386/statfp.c
Normal file
44
sdk/lib/crt/float/i386/statfp.c
Normal file
|
@ -0,0 +1,44 @@
|
|||
/*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS system libraries
|
||||
* FILE: lib/sdk/crt/float/i386/statfp.c
|
||||
* PURPOSE: Unknown
|
||||
* PROGRAMER: Unknown
|
||||
* UPDATE HISTORY:
|
||||
* 25/11/05: Added license header
|
||||
*/
|
||||
|
||||
#include <precomp.h>
|
||||
#include "float.h"
|
||||
|
||||
//WTF IS HAPPENING WITH float.h !??!?!
|
||||
#define _SW_INVALID 0x00000010 /* invalid */
|
||||
#define _SW_ZERODIVIDE 0x00000008 /* zero divide */
|
||||
#define _SW_UNDERFLOW 0x00000002 /* underflow */
|
||||
#define _SW_OVERFLOW 0x00000004 /* overflow */
|
||||
#define _SW_INEXACT 0x00000001 /* inexact (precision) */
|
||||
#define _SW_DENORMAL 0x00080000 /* denormal status bit */
|
||||
|
||||
/**********************************************************************
|
||||
* _statusfp (MSVCRT.@)
|
||||
*/
|
||||
unsigned int CDECL _statusfp(void)
|
||||
{
|
||||
unsigned int retVal = 0;
|
||||
unsigned short fpword;
|
||||
|
||||
#ifdef _M_AMD64
|
||||
fpword = _mm_getcsr();
|
||||
#elif defined(__GNUC__)
|
||||
__asm__ __volatile__( "fstsw %0" : "=m" (fpword) : );
|
||||
#else // _MSC_VER
|
||||
__asm fstsw [fpword];
|
||||
#endif
|
||||
if (fpword & 0x1) retVal |= _SW_INVALID;
|
||||
if (fpword & 0x2) retVal |= _SW_DENORMAL;
|
||||
if (fpword & 0x4) retVal |= _SW_ZERODIVIDE;
|
||||
if (fpword & 0x8) retVal |= _SW_OVERFLOW;
|
||||
if (fpword & 0x10) retVal |= _SW_UNDERFLOW;
|
||||
if (fpword & 0x20) retVal |= _SW_INEXACT;
|
||||
return retVal;
|
||||
}
|
54
sdk/lib/crt/float/isnan.c
Normal file
54
sdk/lib/crt/float/isnan.c
Normal file
|
@ -0,0 +1,54 @@
|
|||
/* Copyright (C) 1991, 1992, 1995 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with the GNU C Library; if not, write to the Free
|
||||
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include <precomp.h>
|
||||
|
||||
#if defined(_MSC_VER) && defined(_M_ARM)
|
||||
#pragma function(_isnan)
|
||||
#endif /* _MSC_VER */
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
int CDECL _isnan(double __x)
|
||||
{
|
||||
union
|
||||
{
|
||||
double* __x;
|
||||
double_s* x;
|
||||
} x;
|
||||
x.__x = &__x;
|
||||
return ( x.x->exponent == 0x7ff && ( x.x->mantissah != 0 || x.x->mantissal != 0 ));
|
||||
}
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
int CDECL _finite(double __x)
|
||||
{
|
||||
union
|
||||
{
|
||||
double* __x;
|
||||
double_s* x;
|
||||
} x;
|
||||
|
||||
x.__x = &__x;
|
||||
|
||||
return ((x.x->exponent & 0x7ff) != 0x7ff);
|
||||
}
|
26
sdk/lib/crt/float/nafter.c
Normal file
26
sdk/lib/crt/float/nafter.c
Normal file
|
@ -0,0 +1,26 @@
|
|||
/*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS system libraries
|
||||
* FILE: lib/sdk/crt/float/nafter.c
|
||||
* PURPOSE: Unknown
|
||||
* PROGRAMER: Unknown
|
||||
* UPDATE HISTORY:
|
||||
* 25/11/05: Added license header
|
||||
*/
|
||||
|
||||
#include <precomp.h>
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
double _nextafter( double x, double y )
|
||||
{
|
||||
WARN("This function is not implemented correctly\n");
|
||||
if ( x == y)
|
||||
return x;
|
||||
|
||||
if ( _isnan(x) || _isnan(y) )
|
||||
return x;
|
||||
|
||||
return x;
|
||||
}
|
17
sdk/lib/crt/float/scalb.c
Normal file
17
sdk/lib/crt/float/scalb.c
Normal file
|
@ -0,0 +1,17 @@
|
|||
/*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS system libraries
|
||||
* FILE: lib/sdk/crt/float/scalb.c
|
||||
* PURPOSE: Floating-point number scaling
|
||||
* PROGRAMER: Pierre Schweitzer (pierre@reactos.org)
|
||||
*/
|
||||
|
||||
#include <precomp.h>
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
double _scalb(double x, long exp)
|
||||
{
|
||||
return ldexp(x, exp);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue