mirror of
https://github.com/reactos/reactos.git
synced 2025-08-06 15:53:03 +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
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;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue