diff --git a/reactos/include/crt/dvec.h b/reactos/include/crt/dvec.h new file mode 100644 index 00000000000..30819bf6a11 --- /dev/null +++ b/reactos/include/crt/dvec.h @@ -0,0 +1,843 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. + */ +#ifndef _DVEC_H_INCLUDED +#define _DVEC_H_INCLUDED +#ifndef RC_INVOKED + +#if !defined __cplusplus +#error This file is only supported in C++ compilations! +#endif + +#include +#include +#include +#include <_mingw.h> + +#pragma pack(push,_CRT_PACKING) + +#if defined(_ENABLE_VEC_DEBUG) +#include +#endif + +#pragma pack(push,16) + +#define EXPLICIT explicit + +class I8vec16; +class Is8vec16; +class Iu8vec16; +class I16vec8; +class Is16vec8; +class Iu16vec8; +class I32vec4; +class Is32vec4; +class Iu32vec4; +class I64vec2; +class I128vec1; + +#define _MM_16UB(element,vector) (*((unsigned char*)&##vector + ##element)) +#define _MM_16B(element,vector) (*((signed char*)&##vector + ##element)) + +#define _MM_8UW(element,vector) (*((unsigned short*)&##vector + ##element)) +#define _MM_8W(element,vector) (*((short*)&##vector + ##element)) + +#define _MM_4UDW(element,vector) (*((unsigned int*)&##vector + ##element)) +#define _MM_4DW(element,vector) (*((int*)&##vector + ##element)) + +#define _MM_2QW(element,vector) (*((__int64*)&##vector + ##element)) + +inline const __m128i get_mask128() +{ + static const __m128i mask128 = _mm_set1_epi64(M64(0xffffffffffffffffi64)); + return mask128; +} + +class M128 +{ +protected: + __m128i vec; + +public: + M128() { } + M128(__m128i mm) { vec = mm; } + + operator __m128i() const { return vec; } + + M128& operator&=(const M128 &a) { return *this = (M128) _mm_and_si128(vec,a); } + M128& operator|=(const M128 &a) { return *this = (M128) _mm_or_si128(vec,a); } + M128& operator^=(const M128 &a) { return *this = (M128) _mm_xor_si128(vec,a); } + +}; + +inline M128 operator&(const M128 &a,const M128 &b) { return _mm_and_si128(a,b); } +inline M128 operator|(const M128 &a,const M128 &b) { return _mm_or_si128(a,b); } +inline M128 operator^(const M128 &a,const M128 &b) { return _mm_xor_si128(a,b); } +inline M128 andnot(const M128 &a,const M128 &b) { return _mm_andnot_si128(a,b); } + +class I128vec1 : public M128 +{ +public: + I128vec1() { } + I128vec1(__m128i mm) : M128(mm) { } + + I128vec1& operator= (const M128 &a) { return *this = (I128vec1) a; } + I128vec1& operator&=(const M128 &a) { return *this = (I128vec1) _mm_and_si128(vec,a); } + I128vec1& operator|=(const M128 &a) { return *this = (I128vec1) _mm_or_si128(vec,a); } + I128vec1& operator^=(const M128 &a) { return *this = (I128vec1) _mm_xor_si128(vec,a); } + +}; + +class I64vec2 : public M128 +{ +public: + I64vec2() { } + I64vec2(__m128i mm) : M128(mm) { } + + I64vec2(__m64 q1,__m64 q0) + { + _MM_2QW(0,vec) = *(__int64*)&q0; + _MM_2QW(1,vec) = *(__int64*)&q1; + } + + I64vec2& operator= (const M128 &a) { return *this = (I64vec2) a; } + + I64vec2& operator&=(const M128 &a) { return *this = (I64vec2) _mm_and_si128(vec,a); } + I64vec2& operator|=(const M128 &a) { return *this = (I64vec2) _mm_or_si128(vec,a); } + I64vec2& operator^=(const M128 &a) { return *this = (I64vec2) _mm_xor_si128(vec,a); } + + I64vec2& operator +=(const I64vec2 &a) { return *this = (I64vec2) _mm_add_epi64(vec,a); } + I64vec2& operator -=(const I64vec2 &a) { return *this = (I64vec2) _mm_sub_epi64(vec,a); } + + I64vec2 operator<<(const I64vec2 &a) { return _mm_sll_epi64(vec,a); } + I64vec2 operator<<(int count) { return _mm_slli_epi64(vec,count); } + I64vec2& operator<<=(const I64vec2 &a) { return *this = (I64vec2) _mm_sll_epi64(vec,a); } + I64vec2& operator<<=(int count) { return *this = (I64vec2) _mm_slli_epi64(vec,count); } + I64vec2 operator>>(const I64vec2 &a) { return _mm_srl_epi64(vec,a); } + I64vec2 operator>>(int count) { return _mm_srli_epi64(vec,count); } + I64vec2& operator>>=(const I64vec2 &a) { return *this = (I64vec2) _mm_srl_epi64(vec,a); } + I64vec2& operator>>=(int count) { return *this = (I64vec2) _mm_srli_epi64(vec,count); } + + const __int64& operator[](int i)const + { + assert(static_cast(i) < 2); + return _MM_2QW(i,vec); + } + + __int64& operator[](int i) + { + assert(static_cast(i) < 2); + return _MM_2QW(i,vec); + } + +}; + +inline I64vec2 unpack_low(const I64vec2 &a,const I64vec2 &b) {return _mm_unpacklo_epi64(a,b); } +inline I64vec2 unpack_high(const I64vec2 &a,const I64vec2 &b) {return _mm_unpackhi_epi64(a,b); } + +class I32vec4 : public M128 +{ +public: + I32vec4() { } + I32vec4(__m128i mm) : M128(mm) { } + + I32vec4& operator= (const M128 &a) { return *this = (I32vec4) a; } + + I32vec4& operator&=(const M128 &a) { return *this = (I32vec4) _mm_and_si128(vec,a); } + I32vec4& operator|=(const M128 &a) { return *this = (I32vec4) _mm_or_si128(vec,a); } + I32vec4& operator^=(const M128 &a) { return *this = (I32vec4) _mm_xor_si128(vec,a); } + + I32vec4& operator +=(const I32vec4 &a) { return *this = (I32vec4)_mm_add_epi32(vec,a); } + I32vec4& operator -=(const I32vec4 &a) { return *this = (I32vec4)_mm_sub_epi32(vec,a); } + + I32vec4 operator<<(const I32vec4 &a) { return _mm_sll_epi32(vec,a); } + I32vec4 operator<<(int count) { return _mm_slli_epi32(vec,count); } + I32vec4& operator<<=(const I32vec4 &a) { return *this = (I32vec4)_mm_sll_epi32(vec,a); } + I32vec4& operator<<=(int count) { return *this = (I32vec4)_mm_slli_epi32(vec,count); } + +}; + +inline I32vec4 cmpeq(const I32vec4 &a,const I32vec4 &b) { return _mm_cmpeq_epi32(a,b); } +inline I32vec4 cmpneq(const I32vec4 &a,const I32vec4 &b) { return _mm_andnot_si128(_mm_cmpeq_epi32(a,b),get_mask128()); } + +inline I32vec4 unpack_low(const I32vec4 &a,const I32vec4 &b) { return _mm_unpacklo_epi32(a,b); } +inline I32vec4 unpack_high(const I32vec4 &a,const I32vec4 &b) { return _mm_unpackhi_epi32(a,b); } + +class Is32vec4 : public I32vec4 +{ +public: + Is32vec4() { } + Is32vec4(__m128i mm) : I32vec4(mm) { } + Is32vec4(int i3,int i2,int i1,int i0) + { + _MM_4DW(0,vec) = i0; + _MM_4DW(1,vec) = i1; + _MM_4DW(2,vec) = i2; + _MM_4DW(3,vec) = i3; + } + + Is32vec4& operator= (const M128 &a) { return *this = (Is32vec4) a; } + + Is32vec4& operator&=(const M128 &a) { return *this = (Is32vec4) _mm_and_si128(vec,a); } + Is32vec4& operator|=(const M128 &a) { return *this = (Is32vec4) _mm_or_si128(vec,a); } + Is32vec4& operator^=(const M128 &a) { return *this = (Is32vec4) _mm_xor_si128(vec,a); } + + Is32vec4& operator +=(const I32vec4 &a) { return *this = (Is32vec4)_mm_add_epi32(vec,a); } + Is32vec4& operator -=(const I32vec4 &a) { return *this = (Is32vec4)_mm_sub_epi32(vec,a); } + + Is32vec4 operator<<(const M128 &a) { return _mm_sll_epi32(vec,a); } + Is32vec4 operator<<(int count) { return _mm_slli_epi32(vec,count); } + Is32vec4& operator<<=(const M128 &a) { return *this = (Is32vec4)_mm_sll_epi32(vec,a); } + Is32vec4& operator<<=(int count) { return *this = (Is32vec4)_mm_slli_epi32(vec,count); } + + Is32vec4 operator>>(const M128 &a) { return _mm_sra_epi32(vec,a); } + Is32vec4 operator>>(int count) { return _mm_srai_epi32(vec,count); } + Is32vec4& operator>>=(const M128 &a) { return *this = (Is32vec4) _mm_sra_epi32(vec,a); } + Is32vec4& operator>>=(int count) { return *this = (Is32vec4) _mm_srai_epi32(vec,count); } + +#if defined(_ENABLE_VEC_DEBUG) + + friend std::ostream& operator<< (std::ostream &os,const Is32vec4 &a) + { + os << "[3]:" << _MM_4DW(3,a) + << " [2]:" << _MM_4DW(2,a) + << " [1]:" << _MM_4DW(1,a) + << " [0]:" << _MM_4DW(0,a); + return os; + } +#endif + + const int& operator[](int i)const + { + assert(static_cast(i) < 4); + return _MM_4DW(i,vec); + } + + int& operator[](int i) + { + assert(static_cast(i) < 4); + return _MM_4DW(i,vec); + } +}; + +inline Is32vec4 cmpeq(const Is32vec4 &a,const Is32vec4 &b) { return _mm_cmpeq_epi32(a,b); } +inline Is32vec4 cmpneq(const Is32vec4 &a,const Is32vec4 &b) { return _mm_andnot_si128(_mm_cmpeq_epi32(a,b),get_mask128()); } +inline Is32vec4 cmpgt(const Is32vec4 &a,const Is32vec4 &b) { return _mm_cmpgt_epi32(a,b); } +inline Is32vec4 cmplt(const Is32vec4 &a,const Is32vec4 &b) { return _mm_cmpgt_epi32(b,a); } + +inline Is32vec4 unpack_low(const Is32vec4 &a,const Is32vec4 &b) { return _mm_unpacklo_epi32(a,b); } +inline Is32vec4 unpack_high(const Is32vec4 &a,const Is32vec4 &b) { return _mm_unpackhi_epi32(a,b); } + +class Iu32vec4 : public I32vec4 +{ +public: + Iu32vec4() { } + Iu32vec4(__m128i mm) : I32vec4(mm) { } + Iu32vec4(unsigned int ui3,unsigned int ui2,unsigned int ui1,unsigned int ui0) + { + _MM_4UDW(0,vec) = ui0; + _MM_4UDW(1,vec) = ui1; + _MM_4UDW(2,vec) = ui2; + _MM_4UDW(3,vec) = ui3; + } + + Iu32vec4& operator= (const M128 &a) { return *this = (Iu32vec4) a; } + + Iu32vec4& operator&=(const M128 &a) { return *this = (Iu32vec4) _mm_and_si128(vec,a); } + Iu32vec4& operator|=(const M128 &a) { return *this = (Iu32vec4) _mm_or_si128(vec,a); } + Iu32vec4& operator^=(const M128 &a) { return *this = (Iu32vec4) _mm_xor_si128(vec,a); } + + Iu32vec4& operator +=(const I32vec4 &a) { return *this = (Iu32vec4)_mm_add_epi32(vec,a); } + Iu32vec4& operator -=(const I32vec4 &a) { return *this = (Iu32vec4)_mm_sub_epi32(vec,a); } + + Iu32vec4 operator<<(const M128 &a) { return _mm_sll_epi32(vec,a); } + Iu32vec4 operator<<(int count) { return _mm_slli_epi32(vec,count); } + Iu32vec4& operator<<=(const M128 &a) { return *this = (Iu32vec4)_mm_sll_epi32(vec,a); } + Iu32vec4& operator<<=(int count) { return *this = (Iu32vec4)_mm_slli_epi32(vec,count); } + Iu32vec4 operator>>(const M128 &a) { return _mm_srl_epi32(vec,a); } + Iu32vec4 operator>>(int count) { return _mm_srli_epi32(vec,count); } + Iu32vec4& operator>>=(const M128 &a) { return *this = (Iu32vec4) _mm_srl_epi32(vec,a); } + Iu32vec4& operator>>=(int count) { return *this = (Iu32vec4) _mm_srli_epi32(vec,count); } + +#if defined(_ENABLE_VEC_DEBUG) + + friend std::ostream& operator<< (std::ostream &os,const Iu32vec4 &a) + { + os << "[3]:" << _MM_4UDW(3,a) + << " [2]:" << _MM_4UDW(2,a) + << " [1]:" << _MM_4UDW(1,a) + << " [0]:" << _MM_4UDW(0,a); + return os; + } +#endif + + const unsigned int& operator[](int i)const + { + assert(static_cast(i) < 4); + return _MM_4UDW(i,vec); + } + + unsigned int& operator[](int i) + { + assert(static_cast(i) < 4); + return _MM_4UDW(i,vec); + } +}; + +inline I64vec2 operator*(const Iu32vec4 &a,const Iu32vec4 &b) { return _mm_mul_epu32(a,b); } +inline Iu32vec4 cmpeq(const Iu32vec4 &a,const Iu32vec4 &b) { return _mm_cmpeq_epi32(a,b); } +inline Iu32vec4 cmpneq(const Iu32vec4 &a,const Iu32vec4 &b) { return _mm_andnot_si128(_mm_cmpeq_epi32(a,b),get_mask128()); } + +inline Iu32vec4 unpack_low(const Iu32vec4 &a,const Iu32vec4 &b) { return _mm_unpacklo_epi32(a,b); } +inline Iu32vec4 unpack_high(const Iu32vec4 &a,const Iu32vec4 &b) { return _mm_unpackhi_epi32(a,b); } + +class I16vec8 : public M128 +{ +public: + I16vec8() { } + I16vec8(__m128i mm) : M128(mm) { } + + I16vec8& operator= (const M128 &a) { return *this = (I16vec8) a; } + + I16vec8& operator&=(const M128 &a) { return *this = (I16vec8) _mm_and_si128(vec,a); } + I16vec8& operator|=(const M128 &a) { return *this = (I16vec8) _mm_or_si128(vec,a); } + I16vec8& operator^=(const M128 &a) { return *this = (I16vec8) _mm_xor_si128(vec,a); } + + I16vec8& operator +=(const I16vec8 &a) { return *this = (I16vec8) _mm_add_epi16(vec,a); } + I16vec8& operator -=(const I16vec8 &a) { return *this = (I16vec8) _mm_sub_epi16(vec,a); } + I16vec8& operator *=(const I16vec8 &a) { return *this = (I16vec8) _mm_mullo_epi16(vec,a); } + + I16vec8 operator<<(const M128 &a) { return _mm_sll_epi16(vec,a); } + I16vec8 operator<<(int count) { return _mm_slli_epi16(vec,count); } + I16vec8& operator<<=(const M128 &a) { return *this = (I16vec8)_mm_sll_epi16(vec,a); } + I16vec8& operator<<=(int count) { return *this = (I16vec8)_mm_slli_epi16(vec,count); } + +}; + +inline I16vec8 operator*(const I16vec8 &a,const I16vec8 &b) { return _mm_mullo_epi16(a,b); } + +inline I16vec8 cmpeq(const I16vec8 &a,const I16vec8 &b) { return _mm_cmpeq_epi16(a,b); } +inline I16vec8 cmpneq(const I16vec8 &a,const I16vec8 &b) { return _mm_andnot_si128(_mm_cmpeq_epi16(a,b),get_mask128()); } + +inline I16vec8 unpack_low(const I16vec8 &a,const I16vec8 &b) { return _mm_unpacklo_epi16(a,b); } +inline I16vec8 unpack_high(const I16vec8 &a,const I16vec8 &b) { return _mm_unpackhi_epi16(a,b); } + +class Is16vec8 : public I16vec8 +{ +public: + Is16vec8() { } + Is16vec8(__m128i mm) : I16vec8(mm) { } + Is16vec8(signed short s7,signed short s6,signed short s5,signed short s4,signed short s3,signed short s2,signed short s1,signed short s0) + { + _MM_8W(0,vec) = s0; + _MM_8W(1,vec) = s1; + _MM_8W(2,vec) = s2; + _MM_8W(3,vec) = s3; + _MM_8W(4,vec) = s4; + _MM_8W(5,vec) = s5; + _MM_8W(6,vec) = s6; + _MM_8W(7,vec) = s7; + } + + Is16vec8& operator= (const M128 &a) { return *this = (Is16vec8) a; } + + Is16vec8& operator&=(const M128 &a) { return *this = (Is16vec8) _mm_and_si128(vec,a); } + Is16vec8& operator|=(const M128 &a) { return *this = (Is16vec8) _mm_or_si128(vec,a); } + Is16vec8& operator^=(const M128 &a) { return *this = (Is16vec8) _mm_xor_si128(vec,a); } + + Is16vec8& operator +=(const I16vec8 &a) { return *this = (Is16vec8) _mm_add_epi16(vec,a); } + Is16vec8& operator -=(const I16vec8 &a) { return *this = (Is16vec8) _mm_sub_epi16(vec,a); } + Is16vec8& operator *=(const I16vec8 &a) { return *this = (Is16vec8) _mm_mullo_epi16(vec,a); } + + Is16vec8 operator<<(const M128 &a) { return _mm_sll_epi16(vec,a); } + Is16vec8 operator<<(int count) { return _mm_slli_epi16(vec,count); } + Is16vec8& operator<<=(const M128 &a) { return *this = (Is16vec8)_mm_sll_epi16(vec,a); } + Is16vec8& operator<<=(int count) { return *this = (Is16vec8)_mm_slli_epi16(vec,count); } + + Is16vec8 operator>>(const M128 &a) { return _mm_sra_epi16(vec,a); } + Is16vec8 operator>>(int count) { return _mm_srai_epi16(vec,count); } + Is16vec8& operator>>=(const M128 &a) { return *this = (Is16vec8)_mm_sra_epi16(vec,a); } + Is16vec8& operator>>=(int count) { return *this = (Is16vec8)_mm_srai_epi16(vec,count); } + +#if defined(_ENABLE_VEC_DEBUG) + + friend std::ostream& operator<< (std::ostream &os,const Is16vec8 &a) + { + os << "[7]:" << _MM_8W(7,a) + << " [6]:" << _MM_8W(6,a) + << " [5]:" << _MM_8W(5,a) + << " [4]:" << _MM_8W(4,a) + << " [3]:" << _MM_8W(3,a) + << " [2]:" << _MM_8W(2,a) + << " [1]:" << _MM_8W(1,a) + << " [0]:" << _MM_8W(0,a); + return os; + } +#endif + + const signed short& operator[](int i)const + { + assert(static_cast(i) < 8); + return _MM_8W(i,vec); + } + + signed short& operator[](int i) + { + assert(static_cast(i) < 8); + return _MM_8W(i,vec); + } +}; + +inline Is16vec8 operator*(const Is16vec8 &a,const Is16vec8 &b) { return _mm_mullo_epi16(a,b); } + +inline Is16vec8 cmpeq(const Is16vec8 &a,const Is16vec8 &b) { return _mm_cmpeq_epi16(a,b); } +inline Is16vec8 cmpneq(const Is16vec8 &a,const Is16vec8 &b) { return _mm_andnot_si128(_mm_cmpeq_epi16(a,b),get_mask128()); } +inline Is16vec8 cmpgt(const Is16vec8 &a,const Is16vec8 &b) { return _mm_cmpgt_epi16(a,b); } +inline Is16vec8 cmplt(const Is16vec8 &a,const Is16vec8 &b) { return _mm_cmpgt_epi16(b,a); } + +inline Is16vec8 unpack_low(const Is16vec8 &a,const Is16vec8 &b) { return _mm_unpacklo_epi16(a,b); } +inline Is16vec8 unpack_high(const Is16vec8 &a,const Is16vec8 &b) { return _mm_unpackhi_epi16(a,b); } + +inline Is16vec8 mul_high(const Is16vec8 &a,const Is16vec8 &b) { return _mm_mulhi_epi16(a,b); } +inline Is32vec4 mul_add(const Is16vec8 &a,const Is16vec8 &b) { return _mm_madd_epi16(a,b);} + +inline Is16vec8 sat_add(const Is16vec8 &a,const Is16vec8 &b) { return _mm_adds_epi16(a,b); } +inline Is16vec8 sat_sub(const Is16vec8 &a,const Is16vec8 &b) { return _mm_subs_epi16(a,b); } + +inline Is16vec8 simd_max(const Is16vec8 &a,const Is16vec8 &b) { return _mm_max_epi16(a,b); } +inline Is16vec8 simd_min(const Is16vec8 &a,const Is16vec8 &b) { return _mm_min_epi16(a,b); } + +class Iu16vec8 : public I16vec8 +{ +public: + Iu16vec8() { } + Iu16vec8(__m128i mm) : I16vec8(mm) { } + Iu16vec8(unsigned short s7,unsigned short s6,unsigned short s5,unsigned short s4,unsigned short s3,unsigned short s2,unsigned short s1,unsigned short s0) + { + _MM_8UW(0,vec) = s0; + _MM_8UW(1,vec) = s1; + _MM_8UW(2,vec) = s2; + _MM_8UW(3,vec) = s3; + _MM_8UW(4,vec) = s4; + _MM_8UW(5,vec) = s5; + _MM_8UW(6,vec) = s6; + _MM_8UW(7,vec) = s7; + } + + Iu16vec8& operator= (const M128 &a) { return *this = (Iu16vec8) a; } + + Iu16vec8& operator&=(const M128 &a) { return *this = (Iu16vec8) _mm_and_si128(vec,a); } + Iu16vec8& operator|=(const M128 &a) { return *this = (Iu16vec8) _mm_or_si128(vec,a); } + Iu16vec8& operator^=(const M128 &a) { return *this = (Iu16vec8) _mm_xor_si128(vec,a); } + + Iu16vec8& operator +=(const I16vec8 &a) { return *this = (Iu16vec8) _mm_add_epi16(vec,a); } + Iu16vec8& operator -=(const I16vec8 &a) { return *this = (Iu16vec8) _mm_sub_epi16(vec,a); } + Iu16vec8& operator *=(const I16vec8 &a) { return *this = (Iu16vec8) _mm_mullo_epi16(vec,a); } + + Iu16vec8 operator<<(const M128 &a) { return _mm_sll_epi16(vec,a); } + Iu16vec8 operator<<(int count) { return _mm_slli_epi16(vec,count); } + Iu16vec8& operator<<=(const M128 &a) { return *this = (Iu16vec8)_mm_sll_epi16(vec,a); } + Iu16vec8& operator<<=(int count) { return *this = (Iu16vec8)_mm_slli_epi16(vec,count); } + Iu16vec8 operator>>(const M128 &a) { return _mm_srl_epi16(vec,a); } + Iu16vec8 operator>>(int count) { return _mm_srli_epi16(vec,count); } + Iu16vec8& operator>>=(const M128 &a) { return *this = (Iu16vec8) _mm_srl_epi16(vec,a); } + Iu16vec8& operator>>=(int count) { return *this = (Iu16vec8) _mm_srli_epi16(vec,count); } + +#if defined(_ENABLE_VEC_DEBUG) + + friend std::ostream& operator << (std::ostream &os,const Iu16vec8 &a) + { + os << "[7]:" << unsigned short(_MM_8UW(7,a)) + << " [6]:" << unsigned short(_MM_8UW(6,a)) + << " [5]:" << unsigned short(_MM_8UW(5,a)) + << " [4]:" << unsigned short(_MM_8UW(4,a)) + << " [3]:" << unsigned short(_MM_8UW(3,a)) + << " [2]:" << unsigned short(_MM_8UW(2,a)) + << " [1]:" << unsigned short(_MM_8UW(1,a)) + << " [0]:" << unsigned short(_MM_8UW(0,a)); + return os; + } +#endif + + const unsigned short& operator[](int i)const + { + assert(static_cast(i) < 8); + return _MM_8UW(i,vec); + } + + unsigned short& operator[](int i) + { + assert(static_cast(i) < 8); + return _MM_8UW(i,vec); + } +}; + +inline Iu16vec8 operator*(const Iu16vec8 &a,const Iu16vec8 &b) { return _mm_mullo_epi16(a,b); } + +inline Iu16vec8 cmpeq(const Iu16vec8 &a,const Iu16vec8 &b) { return _mm_cmpeq_epi16(a,b); } +inline Iu16vec8 cmpneq(const Iu16vec8 &a,const Iu16vec8 &b) { return _mm_andnot_si128(_mm_cmpeq_epi16(a,b),get_mask128()); } + +inline Iu16vec8 unpack_low(const Iu16vec8 &a,const Iu16vec8 &b) { return _mm_unpacklo_epi16(a,b); } +inline Iu16vec8 unpack_high(const Iu16vec8 &a,const Iu16vec8 &b) { return _mm_unpackhi_epi16(a,b); } + +inline Iu16vec8 sat_add(const Iu16vec8 &a,const Iu16vec8 &b) { return _mm_adds_epu16(a,b); } +inline Iu16vec8 sat_sub(const Iu16vec8 &a,const Iu16vec8 &b) { return _mm_subs_epu16(a,b); } + +inline Iu16vec8 simd_avg(const Iu16vec8 &a,const Iu16vec8 &b) { return _mm_avg_epu16(a,b); } +inline I16vec8 mul_high(const Iu16vec8 &a,const Iu16vec8 &b) { return _mm_mulhi_epu16(a,b); } + +class I8vec16 : public M128 +{ +public: + I8vec16() { } + I8vec16(__m128i mm) : M128(mm) { } + + I8vec16& operator= (const M128 &a) { return *this = (I8vec16) a; } + + I8vec16& operator&=(const M128 &a) { return *this = (I8vec16) _mm_and_si128(vec,a); } + I8vec16& operator|=(const M128 &a) { return *this = (I8vec16) _mm_or_si128(vec,a); } + I8vec16& operator^=(const M128 &a) { return *this = (I8vec16) _mm_xor_si128(vec,a); } + + I8vec16& operator +=(const I8vec16 &a) { return *this = (I8vec16) _mm_add_epi8(vec,a); } + I8vec16& operator -=(const I8vec16 &a) { return *this = (I8vec16) _mm_sub_epi8(vec,a); } + +}; + +inline I8vec16 cmpeq(const I8vec16 &a,const I8vec16 &b) { return _mm_cmpeq_epi8(a,b); } +inline I8vec16 cmpneq(const I8vec16 &a,const I8vec16 &b) { return _mm_andnot_si128(_mm_cmpeq_epi8(a,b),get_mask128()); } + +inline I8vec16 unpack_low(const I8vec16 &a,const I8vec16 &b) { return _mm_unpacklo_epi8(a,b); } +inline I8vec16 unpack_high(const I8vec16 &a,const I8vec16 &b) { return _mm_unpackhi_epi8(a,b); } + +class Is8vec16 : public I8vec16 +{ +public: + Is8vec16() { } + Is8vec16(__m128i mm) : I8vec16(mm) { } + + Is8vec16& operator= (const M128 &a) { return *this = (Is8vec16) a; } + + Is8vec16& operator&=(const M128 &a) { return *this = (Is8vec16) _mm_and_si128(vec,a); } + Is8vec16& operator|=(const M128 &a) { return *this = (Is8vec16) _mm_or_si128(vec,a); } + Is8vec16& operator^=(const M128 &a) { return *this = (Is8vec16) _mm_xor_si128(vec,a); } + + Is8vec16& operator +=(const I8vec16 &a) { return *this = (Is8vec16) _mm_add_epi8(vec,a); } + Is8vec16& operator -=(const I8vec16 &a) { return *this = (Is8vec16) _mm_sub_epi8(vec,a); } + +#if defined(_ENABLE_VEC_DEBUG) + + friend std::ostream& operator << (std::ostream &os,const Is8vec16 &a) + { + os << "[15]:" << short(_MM_16B(15,a)) + << " [14]:" << short(_MM_16B(14,a)) + << " [13]:" << short(_MM_16B(13,a)) + << " [12]:" << short(_MM_16B(12,a)) + << " [11]:" << short(_MM_16B(11,a)) + << " [10]:" << short(_MM_16B(10,a)) + << " [9]:" << short(_MM_16B(9,a)) + << " [8]:" << short(_MM_16B(8,a)) + << " [7]:" << short(_MM_16B(7,a)) + << " [6]:" << short(_MM_16B(6,a)) + << " [5]:" << short(_MM_16B(5,a)) + << " [4]:" << short(_MM_16B(4,a)) + << " [3]:" << short(_MM_16B(3,a)) + << " [2]:" << short(_MM_16B(2,a)) + << " [1]:" << short(_MM_16B(1,a)) + << " [0]:" << short(_MM_16B(0,a)); + return os; + } +#endif + + const signed char& operator[](int i)const + { + assert(static_cast(i) < 16); + return _MM_16B(i,vec); + } + + signed char& operator[](int i) + { + assert(static_cast(i) < 16); + return _MM_16B(i,vec); + } + +}; + +inline Is8vec16 cmpeq(const Is8vec16 &a,const Is8vec16 &b) { return _mm_cmpeq_epi8(a,b); } +inline Is8vec16 cmpneq(const Is8vec16 &a,const Is8vec16 &b) { return _mm_andnot_si128(_mm_cmpeq_epi8(a,b),get_mask128()); } +inline Is8vec16 cmpgt(const Is8vec16 &a,const Is8vec16 &b) { return _mm_cmpgt_epi8(a,b); } +inline Is8vec16 cmplt(const Is8vec16 &a,const Is8vec16 &b) { return _mm_cmplt_epi8(a,b); } + +inline Is8vec16 unpack_low(const Is8vec16 &a,const Is8vec16 &b) { return _mm_unpacklo_epi8(a,b); } +inline Is8vec16 unpack_high(const Is8vec16 &a,const Is8vec16 &b) { return _mm_unpackhi_epi8(a,b); } + +inline Is8vec16 sat_add(const Is8vec16 &a,const Is8vec16 &b) { return _mm_adds_epi8(a,b); } +inline Is8vec16 sat_sub(const Is8vec16 &a,const Is8vec16 &b) { return _mm_subs_epi8(a,b); } + +class Iu8vec16 : public I8vec16 +{ +public: + Iu8vec16() { } + Iu8vec16(__m128i mm) : I8vec16(mm) { } + + Iu8vec16& operator= (const M128 &a) { return *this = (Iu8vec16) a; } + + Iu8vec16& operator&=(const M128 &a) { return *this = (Iu8vec16) _mm_and_si128(vec,a); } + Iu8vec16& operator|=(const M128 &a) { return *this = (Iu8vec16) _mm_or_si128(vec,a); } + Iu8vec16& operator^=(const M128 &a) { return *this = (Iu8vec16) _mm_xor_si128(vec,a); } + + Iu8vec16& operator +=(const I8vec16 &a) { return *this = (Iu8vec16) _mm_add_epi8(vec,a); } + Iu8vec16& operator -=(const I8vec16 &a) { return *this = (Iu8vec16) _mm_sub_epi8(vec,a); } + +#if defined(_ENABLE_VEC_DEBUG) + + friend std::ostream& operator << (std::ostream &os,const Iu8vec16 &a) + { + os << "[15]:" << unsigned short(_MM_16UB(15,a)) + << " [14]:" << unsigned short(_MM_16UB(14,a)) + << " [13]:" << unsigned short(_MM_16UB(13,a)) + << " [12]:" << unsigned short(_MM_16UB(12,a)) + << " [11]:" << unsigned short(_MM_16UB(11,a)) + << " [10]:" << unsigned short(_MM_16UB(10,a)) + << " [9]:" << unsigned short(_MM_16UB(9,a)) + << " [8]:" << unsigned short(_MM_16UB(8,a)) + << " [7]:" << unsigned short(_MM_16UB(7,a)) + << " [6]:" << unsigned short(_MM_16UB(6,a)) + << " [5]:" << unsigned short(_MM_16UB(5,a)) + << " [4]:" << unsigned short(_MM_16UB(4,a)) + << " [3]:" << unsigned short(_MM_16UB(3,a)) + << " [2]:" << unsigned short(_MM_16UB(2,a)) + << " [1]:" << unsigned short(_MM_16UB(1,a)) + << " [0]:" << unsigned short(_MM_16UB(0,a)); + return os; + } +#endif + + const unsigned char& operator[](int i)const + { + assert(static_cast(i) < 16); + return _MM_16UB(i,vec); + } + + unsigned char& operator[](int i) + { + assert(static_cast(i) < 16); + return _MM_16UB(i,vec); + } + +}; + +inline Iu8vec16 cmpeq(const Iu8vec16 &a,const Iu8vec16 &b) { return _mm_cmpeq_epi8(a,b); } +inline Iu8vec16 cmpneq(const Iu8vec16 &a,const Iu8vec16 &b) { return _mm_andnot_si128(_mm_cmpeq_epi8(a,b),get_mask128()); } + +inline Iu8vec16 unpack_low(const Iu8vec16 &a,const Iu8vec16 &b) { return _mm_unpacklo_epi8(a,b); } +inline Iu8vec16 unpack_high(const Iu8vec16 &a,const Iu8vec16 &b) { return _mm_unpackhi_epi8(a,b); } + +inline Iu8vec16 sat_add(const Iu8vec16 &a,const Iu8vec16 &b) { return _mm_adds_epu8(a,b); } +inline Iu8vec16 sat_sub(const Iu8vec16 &a,const Iu8vec16 &b) { return _mm_subs_epu8(a,b); } + +inline I64vec2 sum_abs(const Iu8vec16 &a,const Iu8vec16 &b) { return _mm_sad_epu8(a,b); } + +inline Iu8vec16 simd_avg(const Iu8vec16 &a,const Iu8vec16 &b) { return _mm_avg_epu8(a,b); } +inline Iu8vec16 simd_max(const Iu8vec16 &a,const Iu8vec16 &b) { return _mm_max_epu8(a,b); } +inline Iu8vec16 simd_min(const Iu8vec16 &a,const Iu8vec16 &b) { return _mm_min_epu8(a,b); } + +inline Is16vec8 pack_sat(const Is32vec4 &a,const Is32vec4 &b) { return _mm_packs_epi32(a,b); } +inline Is8vec16 pack_sat(const Is16vec8 &a,const Is16vec8 &b) { return _mm_packs_epi16(a,b); } +inline Iu8vec16 packu_sat(const Is16vec8 &a,const Is16vec8 &b) { return _mm_packus_epi16(a,b);} + +#define IVEC128_LOGICALS(vect,element) inline I##vect##vec##element operator& (const I##vect##vec##element &a,const I##vect##vec##element &b) { return _mm_and_si128(a,b); } inline I##vect##vec##element operator| (const I##vect##vec##element &a,const I##vect##vec##element &b) { return _mm_or_si128(a,b); } inline I##vect##vec##element operator^ (const I##vect##vec##element &a,const I##vect##vec##element &b) { return _mm_xor_si128(a,b); } inline I##vect##vec##element andnot (const I##vect##vec##element &a,const I##vect##vec##element &b) { return _mm_andnot_si128(a,b); } + +IVEC128_LOGICALS(8,16) +IVEC128_LOGICALS(u8,16) +IVEC128_LOGICALS(s8,16) +IVEC128_LOGICALS(16,8) +IVEC128_LOGICALS(u16,8) +IVEC128_LOGICALS(s16,8) +IVEC128_LOGICALS(32,4) +IVEC128_LOGICALS(u32,4) +IVEC128_LOGICALS(s32,4) +IVEC128_LOGICALS(64,2) +IVEC128_LOGICALS(128,1) +#undef IVEC128_LOGICALS + +#define IVEC128_ADD_SUB(vect,element,opsize) inline I##vect##vec##element operator+ (const I##vect##vec##element &a,const I##vect##vec##element &b) { return _mm_add_##opsize(a,b); } inline I##vect##vec##element operator- (const I##vect##vec##element &a,const I##vect##vec##element &b) { return _mm_sub_##opsize(a,b); } + +IVEC128_ADD_SUB(8,16,epi8) +IVEC128_ADD_SUB(u8,16,epi8) +IVEC128_ADD_SUB(s8,16,epi8) +IVEC128_ADD_SUB(16,8,epi16) +IVEC128_ADD_SUB(u16,8,epi16) +IVEC128_ADD_SUB(s16,8,epi16) +IVEC128_ADD_SUB(32,4,epi32) +IVEC128_ADD_SUB(u32,4,epi32) +IVEC128_ADD_SUB(s32,4,epi32) +IVEC128_ADD_SUB(64,2,epi64) +#undef IVEC128_ADD_SUB + +#define IVEC128_SELECT(vect12,vect34,element,selop,arg1,arg2) inline I##vect34##vec##element select_##selop (const I##vect12##vec##element &a,const I##vect12##vec##element &b,const I##vect34##vec##element &c,const I##vect34##vec##element &d) { I##vect12##vec##element mask = cmp##selop(a,b); return(I##vect34##vec##element ((mask & arg1) | I##vect12##vec##element ((_mm_andnot_si128(mask,arg2))))); } +IVEC128_SELECT(8,s8,16,eq,c,d) +IVEC128_SELECT(8,u8,16,eq,c,d) +IVEC128_SELECT(8,8,16,eq,c,d) +IVEC128_SELECT(8,s8,16,neq,c,d) +IVEC128_SELECT(8,u8,16,neq,c,d) +IVEC128_SELECT(8,8,16,neq,c,d) + +IVEC128_SELECT(16,s16,8,eq,c,d) +IVEC128_SELECT(16,u16,8,eq,c,d) +IVEC128_SELECT(16,16,8,eq,c,d) +IVEC128_SELECT(16,s16,8,neq,c,d) +IVEC128_SELECT(16,u16,8,neq,c,d) +IVEC128_SELECT(16,16,8,neq,c,d) + +IVEC128_SELECT(32,s32,4,eq,c,d) +IVEC128_SELECT(32,u32,4,eq,c,d) +IVEC128_SELECT(32,32,4,eq,c,d) +IVEC128_SELECT(32,s32,4,neq,c,d) +IVEC128_SELECT(32,u32,4,neq,c,d) +IVEC128_SELECT(32,32,4,neq,c,d) + +IVEC128_SELECT(s8,s8,16,gt,c,d) +IVEC128_SELECT(s8,u8,16,gt,c,d) +IVEC128_SELECT(s8,8,16,gt,c,d) +IVEC128_SELECT(s8,s8,16,lt,c,d) +IVEC128_SELECT(s8,u8,16,lt,c,d) +IVEC128_SELECT(s8,8,16,lt,c,d) + +IVEC128_SELECT(s16,s16,8,gt,c,d) +IVEC128_SELECT(s16,u16,8,gt,c,d) +IVEC128_SELECT(s16,16,8,gt,c,d) +IVEC128_SELECT(s16,s16,8,lt,c,d) +IVEC128_SELECT(s16,u16,8,lt,c,d) +IVEC128_SELECT(s16,16,8,lt,c,d) + +#undef IVEC128_SELECT + +class F64vec2 +{ +protected: + __m128d vec; +public: + + F64vec2() {} + + F64vec2(__m128d m) { vec = m;} + + F64vec2(double d1,double d0) { vec= _mm_set_pd(d1,d0); } + + EXPLICIT F64vec2(double d) { vec = _mm_set1_pd(d); } + + operator __m128d() const { return vec; } + + friend F64vec2 operator &(const F64vec2 &a,const F64vec2 &b) { return _mm_and_pd(a,b); } + friend F64vec2 operator |(const F64vec2 &a,const F64vec2 &b) { return _mm_or_pd(a,b); } + friend F64vec2 operator ^(const F64vec2 &a,const F64vec2 &b) { return _mm_xor_pd(a,b); } + + friend F64vec2 operator +(const F64vec2 &a,const F64vec2 &b) { return _mm_add_pd(a,b); } + friend F64vec2 operator -(const F64vec2 &a,const F64vec2 &b) { return _mm_sub_pd(a,b); } + friend F64vec2 operator *(const F64vec2 &a,const F64vec2 &b) { return _mm_mul_pd(a,b); } + friend F64vec2 operator /(const F64vec2 &a,const F64vec2 &b) { return _mm_div_pd(a,b); } + + F64vec2& operator +=(F64vec2 &a) { return *this = _mm_add_pd(vec,a); } + F64vec2& operator -=(F64vec2 &a) { return *this = _mm_sub_pd(vec,a); } + F64vec2& operator *=(F64vec2 &a) { return *this = _mm_mul_pd(vec,a); } + F64vec2& operator /=(F64vec2 &a) { return *this = _mm_div_pd(vec,a); } + F64vec2& operator &=(F64vec2 &a) { return *this = _mm_and_pd(vec,a); } + F64vec2& operator |=(F64vec2 &a) { return *this = _mm_or_pd(vec,a); } + F64vec2& operator ^=(F64vec2 &a) { return *this = _mm_xor_pd(vec,a); } + + friend double add_horizontal(F64vec2 &a) + { + F64vec2 ftemp = _mm_add_sd(a,_mm_shuffle_pd(a,a,1)); + return ftemp[0]; + } + + friend F64vec2 andnot(const F64vec2 &a,const F64vec2 &b) { return _mm_andnot_pd(a,b); } + + friend F64vec2 sqrt(const F64vec2 &a) { return _mm_sqrt_pd(a); } + +#define F64vec2_COMP(op) friend F64vec2 cmp##op (const F64vec2 &a,const F64vec2 &b) { return _mm_cmp##op##_pd(a,b); } + F64vec2_COMP(eq) + F64vec2_COMP(lt) + F64vec2_COMP(le) + F64vec2_COMP(gt) + F64vec2_COMP(ge) + F64vec2_COMP(ngt) + F64vec2_COMP(nge) + F64vec2_COMP(neq) + F64vec2_COMP(nlt) + F64vec2_COMP(nle) +#undef F64vec2_COMP + + friend F64vec2 simd_min(const F64vec2 &a,const F64vec2 &b) { return _mm_min_pd(a,b); } + friend F64vec2 simd_max(const F64vec2 &a,const F64vec2 &b) { return _mm_max_pd(a,b); } + +#define F64vec2_COMI(op) friend int comi##op (const F64vec2 &a,const F64vec2 &b) { return _mm_comi##op##_sd(a,b); } + F64vec2_COMI(eq) + F64vec2_COMI(lt) + F64vec2_COMI(le) + F64vec2_COMI(gt) + F64vec2_COMI(ge) + F64vec2_COMI(neq) +#undef F64vec2_COMI + +#define F64vec2_UCOMI(op) friend int ucomi##op (const F64vec2 &a,const F64vec2 &b) { return _mm_ucomi##op##_sd(a,b); } + F64vec2_UCOMI(eq) + F64vec2_UCOMI(lt) + F64vec2_UCOMI(le) + F64vec2_UCOMI(gt) + F64vec2_UCOMI(ge) + F64vec2_UCOMI(neq) +#undef F64vec2_UCOMI + +#if defined(_ENABLE_VEC_DEBUG) + + friend std::ostream & operator<<(std::ostream & os,const F64vec2 &a) { + double *dp = (double*)&a; + os << " [1]:" << *(dp+1) + << " [0]:" << *dp; + return os; + } +#endif + + const double &operator[](int i) const { + assert((0 <= i) && (i <= 1)); + double *dp = (double*)&vec; + return *(dp+i); + } + + double &operator[](int i) { + assert((0 <= i) && (i <= 1)); + double *dp = (double*)&vec; + return *(dp+i); + } +}; + +inline F64vec2 unpack_low(const F64vec2 &a,const F64vec2 &b) { return _mm_unpacklo_pd(a,b); } +inline F64vec2 unpack_high(const F64vec2 &a,const F64vec2 &b) { return _mm_unpackhi_pd(a,b); } +inline int move_mask(const F64vec2 &a) { return _mm_movemask_pd(a); } +inline void loadu(F64vec2 &a,double *p) { a = _mm_loadu_pd(p); } +inline void storeu(double *p,const F64vec2 &a) { _mm_storeu_pd(p,a); } +inline void store_nta(double *p,F64vec2 &a) { _mm_stream_pd(p,a); } + +#define F64vec2_SELECT(op) inline F64vec2 select_##op (const F64vec2 &a,const F64vec2 &b,const F64vec2 &c,const F64vec2 &d) { F64vec2 mask = _mm_cmp##op##_pd(a,b); return((mask & c) | F64vec2((_mm_andnot_pd(mask,d)))); } +F64vec2_SELECT(eq) +F64vec2_SELECT(lt) +F64vec2_SELECT(le) +F64vec2_SELECT(gt) +F64vec2_SELECT(ge) +F64vec2_SELECT(neq) +F64vec2_SELECT(nlt) +F64vec2_SELECT(nle) +#undef F64vec2_SELECT + +inline int F64vec2ToInt(const F64vec2 &a) { return _mm_cvttsd_si32(a); } +inline F64vec2 F32vec4ToF64vec2(const F32vec4 &a) { return _mm_cvtps_pd(a); } +inline F32vec4 F64vec2ToF32vec4(const F64vec2 &a) { return _mm_cvtpd_ps(a); } +inline F64vec2 IntToF64vec2(const F64vec2 &a,int b) { return _mm_cvtsi32_sd(a,b); } + +#pragma pack(pop) +#pragma pack(pop) +#endif +#endif diff --git a/reactos/include/crt/eh.h b/reactos/include/crt/eh.h new file mode 100644 index 00000000000..0feb2dd9c27 --- /dev/null +++ b/reactos/include/crt/eh.h @@ -0,0 +1,40 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. + */ +#include <_mingw.h> + +#ifndef _EH_H_ +#define _EH_H_ + +#ifndef RC_INVOKED + +#pragma pack(push,_CRT_PACKING) + +#ifndef __cplusplus +#error eh.h is only for C++! +#endif + +typedef void (__cdecl *terminate_function)(); +typedef void (__cdecl *terminate_handler)(); +typedef void (__cdecl *unexpected_function)(); +typedef void (__cdecl *unexpected_handler)(); + +struct _EXCEPTION_POINTERS; +typedef void (__cdecl *_se_translator_function)(unsigned int,struct _EXCEPTION_POINTERS *); + +_CRTIMP __declspec(noreturn) void __cdecl terminate(void); +_CRTIMP void __cdecl unexpected(void); +_CRTIMP int __cdecl _is_exception_typeof(const type_info &_Type,struct _EXCEPTION_POINTERS *_ExceptionPtr); +_CRTIMP terminate_function __cdecl set_terminate(terminate_function _NewPtFunc); +extern "C" _CRTIMP terminate_function __cdecl _get_terminate(void); +_CRTIMP unexpected_function __cdecl set_unexpected(unexpected_function _NewPtFunc); +extern "C" _CRTIMP unexpected_function __cdecl _get_unexpected(void); +_CRTIMP _se_translator_function __cdecl _set_se_translator(_se_translator_function _NewPtFunc); +_CRTIMP bool __cdecl __uncaught_exception(); + +#pragma pack(pop) +#endif +#endif /* End _EH_H_ */ + diff --git a/reactos/include/crt/fpieee.h b/reactos/include/crt/fpieee.h new file mode 100644 index 00000000000..67d9fb0e225 --- /dev/null +++ b/reactos/include/crt/fpieee.h @@ -0,0 +1,140 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. + */ +#ifndef _INC_FPIEEE +#define _INC_FPIEEE + +#include <_mingw.h> + +#pragma pack(push,_CRT_PACKING) + +#ifdef __cplusplus +extern "C" { +#endif + + typedef enum { + _FpCompareEqual,_FpCompareGreater,_FpCompareLess,_FpCompareUnordered + } _FPIEEE_COMPARE_RESULT; + + typedef enum { + _FpFormatFp32,_FpFormatFp64,_FpFormatFp80,_FpFormatFp128,_FpFormatI16,_FpFormatI32,_FpFormatI64,_FpFormatU16,_FpFormatU32,_FpFormatU64,_FpFormatBcd80,_FpFormatCompare,_FpFormatString, +#if defined(__ia64__) + _FpFormatFp82 +#endif + } _FPIEEE_FORMAT; + + typedef enum { + _FpCodeUnspecified,_FpCodeAdd,_FpCodeSubtract,_FpCodeMultiply,_FpCodeDivide,_FpCodeSquareRoot,_FpCodeRemainder,_FpCodeCompare,_FpCodeConvert,_FpCodeRound,_FpCodeTruncate,_FpCodeFloor,_FpCodeCeil,_FpCodeAcos,_FpCodeAsin,_FpCodeAtan,_FpCodeAtan2,_FpCodeCabs,_FpCodeCos,_FpCodeCosh,_FpCodeExp,_FpCodeFabs,_FpCodeFmod,_FpCodeFrexp,_FpCodeHypot,_FpCodeLdexp,_FpCodeLog,_FpCodeLog10,_FpCodeModf,_FpCodePow,_FpCodeSin,_FpCodeSinh,_FpCodeTan,_FpCodeTanh,_FpCodeY0,_FpCodeY1,_FpCodeYn,_FpCodeLogb,_FpCodeNextafter,_FpCodeNegate,_FpCodeFmin,_FpCodeFmax,_FpCodeConvertTrunc,_XMMIAddps,_XMMIAddss,_XMMISubps,_XMMISubss,_XMMIMulps,_XMMIMulss,_XMMIDivps,_XMMIDivss,_XMMISqrtps,_XMMISqrtss,_XMMIMaxps,_XMMIMaxss,_XMMIMinps,_XMMIMinss,_XMMICmpps,_XMMICmpss,_XMMIComiss,_XMMIUComiss,_XMMICvtpi2ps,_XMMICvtsi2ss,_XMMICvtps2pi,_XMMICvtss2si,_XMMICvttps2pi,_XMMICvttss2si,_XMMIAddsubps,_XMMIHaddps,_XMMIHsubps,_XMMI2Addpd,_XMMI2Addsd,_XMMI2Subpd,_XMMI2Subsd,_XMMI2Mulpd,_XMMI2Mulsd,_XMMI2Divpd,_XMMI2Divsd,_XMMI2Sqrtpd,_XMMI2Sqrtsd,_XMMI2Maxpd,_XMMI2Maxsd,_XMMI2Minpd,_XMMI2Minsd,_XMMI2Cmppd,_XMMI2Cmpsd,_XMMI2Comisd,_XMMI2UComisd,_XMMI2Cvtpd2pi,_XMMI2Cvtsd2si,_XMMI2Cvttpd2pi,_XMMI2Cvttsd2si,_XMMI2Cvtps2pd,_XMMI2Cvtss2sd,_XMMI2Cvtpd2ps,_XMMI2Cvtsd2ss,_XMMI2Cvtdq2ps,_XMMI2Cvttps2dq,_XMMI2Cvtps2dq,_XMMI2Cvttpd2dq,_XMMI2Cvtpd2dq,_XMMI2Addsubpd,_XMMI2Haddpd,_XMMI2Hsubpd, +#if defined(__ia64__) + _FpCodeFma,_FpCodeFmaSingle,_FpCodeFmaDouble,_FpCodeFms,_FpCodeFmsSingle,_FpCodeFmsDouble,_FpCodeFnma,_FpCodeFnmaSingle,_FpCodeFnmaDouble,_FpCodeFamin,_FpCodeFamax +#endif + } _FP_OPERATION_CODE; + + typedef enum { + _FpRoundNearest,_FpRoundMinusInfinity,_FpRoundPlusInfinity,_FpRoundChopped + } _FPIEEE_ROUNDING_MODE; + + typedef enum { + _FpPrecisionFull,_FpPrecision53,_FpPrecision24, +#if defined(__ia64__) + _FpPrecision64,_FpPrecision113 +#endif + } _FPIEEE_PRECISION; + + typedef float _FP32; + typedef double _FP64; + typedef short _I16; + typedef int _I32; + typedef unsigned short _U16; + typedef unsigned int _U32; + typedef __int64 _Q64; + + typedef struct +#if defined(__ia64__) + _CRT_ALIGN(16) +#endif + { + unsigned short W[5]; + } _FP80; + + typedef struct _CRT_ALIGN(16) { + unsigned long W[4]; + } _FP128; + + typedef struct _CRT_ALIGN(8) { + unsigned long W[2]; + } _I64; + + typedef struct _CRT_ALIGN(8) { + unsigned long W[2]; + } _U64; + + typedef struct +#if defined(__ia64__) + _CRT_ALIGN(16) +#endif + { + unsigned short W[5]; + } _BCD80; + + typedef struct _CRT_ALIGN(16) { + _Q64 W[2]; + } _FPQ64; + + typedef struct { + union { + _FP32 Fp32Value; + _FP64 Fp64Value; + _FP80 Fp80Value; + _FP128 Fp128Value; + _I16 I16Value; + _I32 I32Value; + _I64 I64Value; + _U16 U16Value; + _U32 U32Value; + _U64 U64Value; + _BCD80 Bcd80Value; + char *StringValue; + int CompareValue; + _Q64 Q64Value; + _FPQ64 Fpq64Value; + } Value; + unsigned int OperandValid : 1; + unsigned int Format : 4; + } _FPIEEE_VALUE; + + typedef struct { + unsigned int Inexact : 1; + unsigned int Underflow : 1; + unsigned int Overflow : 1; + unsigned int ZeroDivide : 1; + unsigned int InvalidOperation : 1; + } _FPIEEE_EXCEPTION_FLAGS; + + typedef struct { + unsigned int RoundingMode : 2; + unsigned int Precision : 3; + unsigned int Operation :12; + _FPIEEE_EXCEPTION_FLAGS Cause; + _FPIEEE_EXCEPTION_FLAGS Enable; + _FPIEEE_EXCEPTION_FLAGS Status; + _FPIEEE_VALUE Operand1; + _FPIEEE_VALUE Operand2; + _FPIEEE_VALUE Result; +#if defined(__ia64__) + _FPIEEE_VALUE Operand3; +#endif + } _FPIEEE_RECORD,*_PFPIEEE_RECORD; + + struct _EXCEPTION_POINTERS; + + _CRTIMP int __cdecl _fpieee_flt(unsigned long _ExceptionCode,struct _EXCEPTION_POINTERS *_PtExceptionPtr,int (__cdecl *_Handler)(_FPIEEE_RECORD *)); + +#ifdef __cplusplus +} +#endif + +#pragma pack(pop) +#endif diff --git a/reactos/include/crt/fvec.h b/reactos/include/crt/fvec.h new file mode 100644 index 00000000000..d23fae60a3c --- /dev/null +++ b/reactos/include/crt/fvec.h @@ -0,0 +1,244 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. + */ +#ifndef _FVEC_H_INCLUDED +#define _FVEC_H_INCLUDED + +#ifndef RC_INVOKED +#ifndef __cplusplus +#error ERROR: This file is only supported in C++ compilations! +#endif + +#include +#include +#include +#include <_mingw.h> + +#if defined(_ENABLE_VEC_DEBUG) +#include +#endif + +#pragma pack(push,_CRT_PACKING) +#pragma pack(push,16) + +#define EXPLICIT explicit + +class F32vec4 { +protected: + __m128 vec; +public: + F32vec4() {} + F32vec4(__m128 m) { vec = m;} + F32vec4(float f3,float f2,float f1,float f0) { vec= _mm_set_ps(f3,f2,f1,f0); } + EXPLICIT F32vec4(float f) { vec = _mm_set_ps1(f); } + EXPLICIT F32vec4(double d) { vec = _mm_set_ps1((float) d); } + F32vec4& operator =(float f) { vec = _mm_set_ps1(f); return *this; } + F32vec4& operator =(double d) { vec = _mm_set_ps1((float) d); return *this; } + operator __m128() const { return vec; } + friend F32vec4 operator &(const F32vec4 &a,const F32vec4 &b) { return _mm_and_ps(a,b); } + friend F32vec4 operator |(const F32vec4 &a,const F32vec4 &b) { return _mm_or_ps(a,b); } + friend F32vec4 operator ^(const F32vec4 &a,const F32vec4 &b) { return _mm_xor_ps(a,b); } + friend F32vec4 operator +(const F32vec4 &a,const F32vec4 &b) { return _mm_add_ps(a,b); } + friend F32vec4 operator -(const F32vec4 &a,const F32vec4 &b) { return _mm_sub_ps(a,b); } + friend F32vec4 operator *(const F32vec4 &a,const F32vec4 &b) { return _mm_mul_ps(a,b); } + friend F32vec4 operator /(const F32vec4 &a,const F32vec4 &b) { return _mm_div_ps(a,b); } + F32vec4& operator =(const F32vec4 &a) { vec = a.vec; return *this; } + F32vec4& operator =(const __m128 &avec) { vec = avec; return *this; } + F32vec4& operator +=(F32vec4 &a) { return *this = _mm_add_ps(vec,a); } + F32vec4& operator -=(F32vec4 &a) { return *this = _mm_sub_ps(vec,a); } + F32vec4& operator *=(F32vec4 &a) { return *this = _mm_mul_ps(vec,a); } + F32vec4& operator /=(F32vec4 &a) { return *this = _mm_div_ps(vec,a); } + F32vec4& operator &=(F32vec4 &a) { return *this = _mm_and_ps(vec,a); } + F32vec4& operator |=(F32vec4 &a) { return *this = _mm_or_ps(vec,a); } + F32vec4& operator ^=(F32vec4 &a) { return *this = _mm_xor_ps(vec,a); } + friend float add_horizontal(F32vec4 &a) { + F32vec4 ftemp = _mm_add_ss(a,_mm_add_ss(_mm_shuffle_ps(a,a,1),_mm_add_ss(_mm_shuffle_ps(a,a,2),_mm_shuffle_ps(a,a,3)))); + return ftemp[0]; + } + friend F32vec4 sqrt(const F32vec4 &a) { return _mm_sqrt_ps(a); } + friend F32vec4 rcp(const F32vec4 &a) { return _mm_rcp_ps(a); } + friend F32vec4 rsqrt(const F32vec4 &a) { return _mm_rsqrt_ps(a); } + friend F32vec4 rcp_nr(const F32vec4 &a) { + F32vec4 Ra0 = _mm_rcp_ps(a); + return _mm_sub_ps(_mm_add_ps(Ra0,Ra0),_mm_mul_ps(_mm_mul_ps(Ra0,a),Ra0)); + } + friend F32vec4 rsqrt_nr(const F32vec4 &a) { + static const F32vec4 fvecf0pt5(0.5f); + static const F32vec4 fvecf3pt0(3.0f); + F32vec4 Ra0 = _mm_rsqrt_ps(a); + return (fvecf0pt5 *Ra0) *(fvecf3pt0 - (a *Ra0) *Ra0); + + } +#define Fvec32s4_COMP(op) friend F32vec4 cmp##op (const F32vec4 &a,const F32vec4 &b) { return _mm_cmp##op##_ps(a,b); } + Fvec32s4_COMP(eq) + Fvec32s4_COMP(lt) + Fvec32s4_COMP(le) + Fvec32s4_COMP(gt) + Fvec32s4_COMP(ge) + Fvec32s4_COMP(neq) + Fvec32s4_COMP(nlt) + Fvec32s4_COMP(nle) + Fvec32s4_COMP(ngt) + Fvec32s4_COMP(nge) +#undef Fvec32s4_COMP + + friend F32vec4 simd_min(const F32vec4 &a,const F32vec4 &b) { return _mm_min_ps(a,b); } + friend F32vec4 simd_max(const F32vec4 &a,const F32vec4 &b) { return _mm_max_ps(a,b); } + +#if defined(_ENABLE_VEC_DEBUG) + friend std::ostream & operator<<(std::ostream & os,const F32vec4 &a) { + float *fp = (float*)&a; + os << "[3]:" << *(fp+3) + << " [2]:" << *(fp+2) + << " [1]:" << *(fp+1) + << " [0]:" << *fp; + return os; + } +#endif + const float& operator[](int i) const { + assert((0 <= i) && (i <= 3)); + float *fp = (float*)&vec; + return *(fp+i); + } + float& operator[](int i) { + assert((0 <= i) && (i <= 3)); + float *fp = (float*)&vec; + return *(fp+i); + } +}; + +inline F32vec4 unpack_low(const F32vec4 &a,const F32vec4 &b) { return _mm_unpacklo_ps(a,b); } +inline F32vec4 unpack_high(const F32vec4 &a,const F32vec4 &b) { return _mm_unpackhi_ps(a,b); } +inline int move_mask(const F32vec4 &a) { return _mm_movemask_ps(a); } +inline void loadu(F32vec4 &a,float *p) { a = _mm_loadu_ps(p); } +inline void storeu(float *p,const F32vec4 &a) { _mm_storeu_ps(p,a); } +inline void store_nta(float *p,F32vec4 &a) { _mm_stream_ps(p,a); } + +#define Fvec32s4_SELECT(op) inline F32vec4 select_##op (const F32vec4 &a,const F32vec4 &b,const F32vec4 &c,const F32vec4 &d) { F32vec4 mask = _mm_cmp##op##_ps(a,b); return((mask & c) | F32vec4((_mm_andnot_ps(mask,d)))); } +Fvec32s4_SELECT(eq) +Fvec32s4_SELECT(lt) +Fvec32s4_SELECT(le) +Fvec32s4_SELECT(gt) +Fvec32s4_SELECT(ge) +Fvec32s4_SELECT(neq) +Fvec32s4_SELECT(nlt) +Fvec32s4_SELECT(nle) +Fvec32s4_SELECT(ngt) +Fvec32s4_SELECT(nge) +#undef Fvec32s4_SELECT + +inline Is16vec4 simd_max(const Is16vec4 &a,const Is16vec4 &b) { return _m_pmaxsw(a,b); } +inline Is16vec4 simd_min(const Is16vec4 &a,const Is16vec4 &b) { return _m_pminsw(a,b); } +inline Iu8vec8 simd_max(const Iu8vec8 &a,const Iu8vec8 &b) { return _m_pmaxub(a,b); } +inline Iu8vec8 simd_min(const Iu8vec8 &a,const Iu8vec8 &b) { return _m_pminub(a,b); } +inline Iu16vec4 simd_avg(const Iu16vec4 &a,const Iu16vec4 &b) { return _m_pavgw(a,b); } +inline Iu8vec8 simd_avg(const Iu8vec8 &a,const Iu8vec8 &b) { return _m_pavgb(a,b); } +inline int move_mask(const I8vec8 &a) { return _m_pmovmskb(a); } +inline Iu16vec4 mul_high(const Iu16vec4 &a,const Iu16vec4 &b) { return _m_pmulhuw(a,b); } +inline void mask_move(const I8vec8 &a,const I8vec8 &b,char *addr) { _m_maskmovq(a,b,addr); } +inline void store_nta(__m64 *p,M64 &a) { _mm_stream_pi(p,a); } +inline int F32vec4ToInt(const F32vec4 &a) { return _mm_cvtt_ss2si(a); } +inline Is32vec2 F32vec4ToIs32vec2 (const F32vec4 &a) { + __m64 result; + result = _mm_cvtt_ps2pi(a); + return Is32vec2(result); +} + +inline F32vec4 IntToF32vec4(const F32vec4 &a,int i) { + __m128 result; + result = _mm_cvt_si2ss(a,i); + return F32vec4(result); +} + +inline F32vec4 Is32vec2ToF32vec4(const F32vec4 &a,const Is32vec2 &b) { + __m128 result; + result = _mm_cvt_pi2ps(a,b); + return F32vec4(result); +} + +class F32vec1 { +protected: + __m128 vec; +public: + F32vec1() {} + F32vec1(int i) { vec = _mm_cvt_si2ss(vec,i);}; + EXPLICIT F32vec1(float f) { vec = _mm_set_ss(f); } + EXPLICIT F32vec1(double d) { vec = _mm_set_ss((float) d); } + F32vec1(__m128 m) { vec = m; } + operator __m128() const { return vec; } + friend F32vec1 operator &(const F32vec1 &a,const F32vec1 &b) { return _mm_and_ps(a,b); } + friend F32vec1 operator |(const F32vec1 &a,const F32vec1 &b) { return _mm_or_ps(a,b); } + friend F32vec1 operator ^(const F32vec1 &a,const F32vec1 &b) { return _mm_xor_ps(a,b); } + friend F32vec1 operator +(const F32vec1 &a,const F32vec1 &b) { return _mm_add_ss(a,b); } + friend F32vec1 operator -(const F32vec1 &a,const F32vec1 &b) { return _mm_sub_ss(a,b); } + friend F32vec1 operator *(const F32vec1 &a,const F32vec1 &b) { return _mm_mul_ss(a,b); } + friend F32vec1 operator /(const F32vec1 &a,const F32vec1 &b) { return _mm_div_ss(a,b); } + F32vec1& operator +=(F32vec1 &a) { return *this = _mm_add_ss(vec,a); } + F32vec1& operator -=(F32vec1 &a) { return *this = _mm_sub_ss(vec,a); } + F32vec1& operator *=(F32vec1 &a) { return *this = _mm_mul_ss(vec,a); } + F32vec1& operator /=(F32vec1 &a) { return *this = _mm_div_ss(vec,a); } + F32vec1& operator &=(F32vec1 &a) { return *this = _mm_and_ps(vec,a); } + F32vec1& operator |=(F32vec1 &a) { return *this = _mm_or_ps(vec,a); } + F32vec1& operator ^=(F32vec1 &a) { return *this = _mm_xor_ps(vec,a); } + friend F32vec1 sqrt(const F32vec1 &a) { return _mm_sqrt_ss(a); } + friend F32vec1 rcp(const F32vec1 &a) { return _mm_rcp_ss(a); } + friend F32vec1 rsqrt(const F32vec1 &a) { return _mm_rsqrt_ss(a); } + friend F32vec1 rcp_nr(const F32vec1 &a) { + F32vec1 Ra0 = _mm_rcp_ss(a); + return _mm_sub_ss(_mm_add_ss(Ra0,Ra0),_mm_mul_ss(_mm_mul_ss(Ra0,a),Ra0)); + } + friend F32vec1 rsqrt_nr(const F32vec1 &a) { + static const F32vec1 fvecf0pt5(0.5f); + static const F32vec1 fvecf3pt0(3.0f); + F32vec1 Ra0 = _mm_rsqrt_ss(a); + return (fvecf0pt5 *Ra0) *(fvecf3pt0 - (a *Ra0) *Ra0); + } +#define Fvec32s1_COMP(op) friend F32vec1 cmp##op (const F32vec1 &a,const F32vec1 &b) { return _mm_cmp##op##_ss(a,b); } + Fvec32s1_COMP(eq) + Fvec32s1_COMP(lt) + Fvec32s1_COMP(le) + Fvec32s1_COMP(gt) + Fvec32s1_COMP(ge) + Fvec32s1_COMP(neq) + Fvec32s1_COMP(nlt) + Fvec32s1_COMP(nle) + Fvec32s1_COMP(ngt) + Fvec32s1_COMP(nge) +#undef Fvec32s1_COMP + + friend F32vec1 simd_min(const F32vec1 &a,const F32vec1 &b) { return _mm_min_ss(a,b); } + friend F32vec1 simd_max(const F32vec1 &a,const F32vec1 &b) { return _mm_max_ss(a,b); } + +#if defined(_ENABLE_VEC_DEBUG) + friend std::ostream & operator<<(std::ostream & os,const F32vec1 &a) { + float *fp = (float*)&a; + os << "float:" << *fp; + return os; + } +#endif +}; + +#define Fvec32s1_SELECT(op) inline F32vec1 select_##op (const F32vec1 &a,const F32vec1 &b,const F32vec1 &c,const F32vec1 &d) { F32vec1 mask = _mm_cmp##op##_ss(a,b); return((mask & c) | F32vec1((_mm_andnot_ps(mask,d)))); } +Fvec32s1_SELECT(eq) +Fvec32s1_SELECT(lt) +Fvec32s1_SELECT(le) +Fvec32s1_SELECT(gt) +Fvec32s1_SELECT(ge) +Fvec32s1_SELECT(neq) +Fvec32s1_SELECT(nlt) +Fvec32s1_SELECT(nle) +Fvec32s1_SELECT(ngt) +Fvec32s1_SELECT(nge) +#undef Fvec32s1_SELECT + +inline int F32vec1ToInt(const F32vec1 &a) +{ + return _mm_cvtt_ss2si(a); +} + +#pragma pack(pop) +#pragma pack(pop) +#endif +#endif diff --git a/reactos/include/crt/minmax.h b/reactos/include/crt/minmax.h new file mode 100644 index 00000000000..fb80259018d --- /dev/null +++ b/reactos/include/crt/minmax.h @@ -0,0 +1,21 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. + */ +#ifndef _INC_MINMAX +#define _INC_MINMAX + +#ifndef __cplusplus +#ifndef NOMINMAX +#ifndef max +#define max(a,b) (((a) > (b)) ? (a) : (b)) +#endif + +#ifndef min +#define min(a,b) (((a) < (b)) ? (a) : (b)) +#endif +#endif +#endif + +#endif diff --git a/reactos/include/crt/new.h b/reactos/include/crt/new.h new file mode 100644 index 00000000000..67e2a0cf0bd --- /dev/null +++ b/reactos/include/crt/new.h @@ -0,0 +1,45 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. + */ +#ifndef _INC_NEW +#define _INC_NEW + +#ifdef __cplusplus + +#include + +#include <_mingw.h> + +#pragma push_macro("new") +#undef new + +#ifndef __NOTHROW_T_DEFINED +#define __NOTHROW_T_DEFINED +#endif + +#ifndef __PLACEMENT_NEW_INLINE +#define __PLACEMENT_NEW_INLINE +#endif + +_CRTIMP int __cdecl _query_new_mode(void); +_CRTIMP int __cdecl _set_new_mode(int _NewMode); + +#ifndef _PNH_DEFINED +typedef int (__cdecl *_PNH)(size_t); +#define _PNH_DEFINED +#endif + +_CRTIMP _PNH __cdecl _query_new_handler(void); +_CRTIMP _PNH __cdecl _set_new_handler(_PNH _NewHandler); + +#ifndef _NO_ANSI_NH_DEFINED +#define _NO_ANSI_NEW_HANDLER ((new_handler)-1) +#define _NO_ANSI_NEW_HANDLER_M ((_new_handler_m)-1) +#define _NO_ANSI_NH_DEFINED +#endif + +#pragma pop_macro("new") +#endif +#endif diff --git a/reactos/include/crt/pgobootrun.h b/reactos/include/crt/pgobootrun.h new file mode 100644 index 00000000000..f1a2b1af168 --- /dev/null +++ b/reactos/include/crt/pgobootrun.h @@ -0,0 +1,30 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. + */ +#ifdef _WCHAR_T_DEFINED +typedef void (__cdecl *POGOAUTOSWEEPPROCW)(const wchar_t *); +#else +typedef void (__cdecl *POGOAUTOSWEEPPROCW)(const unsigned short *); +#endif +typedef void (__cdecl *POGOAUTOSWEEPPROCA)(const char *); + +#ifdef __cplusplus +extern "C" +#else +extern +#endif +POGOAUTOSWEEPPROCW PogoAutoSweepW; +#ifdef __cplusplus +extern "C" +#else +extern +#endif +POGOAUTOSWEEPPROCA PogoAutoSweepA; + +#ifdef UNICODE +#define PgoAutoSweep PogoAutoSweepW +#else +#define PgoAutoSweep PogoAutoSweepA +#endif diff --git a/reactos/include/crt/rtcapi.h b/reactos/include/crt/rtcapi.h new file mode 100644 index 00000000000..17247a7f2f2 --- /dev/null +++ b/reactos/include/crt/rtcapi.h @@ -0,0 +1,93 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. + */ +#ifndef _INC_RTCAPI +#define _INC_RTCAPI + +#include <_mingw.h> + +#pragma pack(push,_CRT_PACKING) + +#define _RTCINTERNAL_DEPRECATED + +#ifdef __cplusplus +extern "C" { +#endif + + typedef enum _RTC_ErrorNumber { + _RTC_CHKSTK = 0,_RTC_CVRT_LOSS_INFO,_RTC_CORRUPT_STACK,_RTC_UNINIT_LOCAL_USE,_RTC_CORRUPTED_ALLOCA,_RTC_ILLEGAL + } _RTC_ErrorNumber; + +#define _RTC_ERRTYPE_IGNORE -1 +#define _RTC_ERRTYPE_ASK -2 + +#ifndef _WCHAR_T_DEFINED +#define _WCHAR_T_DEFINED + typedef unsigned short wchar_t; +#endif + + typedef int (__cdecl *_RTC_error_fn)(int,const char *,int,const char *,const char *,...); + typedef int (__cdecl *_RTC_error_fnW)(int,const wchar_t *,int,const wchar_t *,const wchar_t *,...); + + int __cdecl _RTC_NumErrors(void); + const char *__cdecl _RTC_GetErrDesc(_RTC_ErrorNumber _Errnum); + int __cdecl _RTC_SetErrorType(_RTC_ErrorNumber _Errnum,int _ErrType); + _RTC_error_fn __cdecl _RTC_SetErrorFunc(_RTC_error_fn); + _RTC_error_fnW __cdecl _RTC_SetErrorFuncW(_RTC_error_fnW); + void __cdecl _RTC_Initialize(void); + void __cdecl _RTC_Terminate(void); + _RTC_error_fn __cdecl _CRT_RTC_INIT(void *_Res0,void **_Res1,int _Res2,int _Res3,int _Res4); + _RTC_error_fnW __cdecl _CRT_RTC_INITW(void *_Res0,void **_Res1,int _Res2,int _Res3,int _Res4); + + typedef struct _RTC_vardesc { + int addr; + int size; + char *name; + } _RTC_vardesc; + + typedef struct _RTC_framedesc { + int varCount; + _RTC_vardesc *variables; + } _RTC_framedesc; + +#pragma pack(push,1) + + typedef struct _RTC_ALLOCA_NODE { + __int32 guard1; + struct _RTC_ALLOCA_NODE *next; +#if (defined(_X86_) && !defined(__x86_64)) + __int32 dummypad; +#endif + size_t allocaSize; +#if (defined(_X86_) && !defined(__x86_64)) + __int32 dummypad2; +#endif + __int32 guard2[3]; + } _RTC_ALLOCA_NODE; +#pragma pack(pop) + + char __fastcall _RTC_Check_2_to_1(short _Src); + char __fastcall _RTC_Check_4_to_1(int _Src); + char __fastcall _RTC_Check_8_to_1(__int64 _Src); + short __fastcall _RTC_Check_4_to_2(int _Src); + short __fastcall _RTC_Check_8_to_2(__int64 _Src); + int __fastcall _RTC_Check_8_to_4(__int64 _Src); + +#if (defined(_X86_) && !defined(__x86_64)) + void __cdecl _RTC_CheckEsp(); +#endif + void __fastcall _RTC_CheckStackVars(void *_Esp,_RTC_framedesc *_Fd); + void __fastcall _RTC_CheckStackVars2(void *_Esp,_RTC_framedesc *_Fd,_RTC_ALLOCA_NODE *_AllocaList); + void __fastcall _RTC_AllocaHelper(_RTC_ALLOCA_NODE *_PAllocaBase,size_t _CbSize,_RTC_ALLOCA_NODE **_PAllocaInfoList); + void __cdecl _RTC_UninitUse(const char *_Varname); + void __cdecl _RTC_Shutdown(void); + void __cdecl _RTC_InitBase(void); +#ifdef __cplusplus + void *_ReturnAddress(); +} +#endif + +#pragma pack(pop) +#endif diff --git a/reactos/include/crt/setjmpex.h b/reactos/include/crt/setjmpex.h new file mode 100644 index 00000000000..164e7b8cef4 --- /dev/null +++ b/reactos/include/crt/setjmpex.h @@ -0,0 +1,24 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. + */ +#ifndef _INC_SETJMPEX +#define _INC_SETJMPEX + +#ifndef _WIN32 +#error Only Win32 target is supported! +#endif + +#if (defined(_X86_) && !defined(__x86_64)) +#define setjmp _setjmp +#define longjmp _longjmpex +#else +#ifdef setjmp +#undef setjmp +#endif +#define setjmp _setjmpex +#endif + +#include +#endif diff --git a/reactos/include/crt/stdexcpt.h b/reactos/include/crt/stdexcpt.h new file mode 100644 index 00000000000..a181ffcecd3 --- /dev/null +++ b/reactos/include/crt/stdexcpt.h @@ -0,0 +1,15 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. + */ +#include <_mingw.h> + +#ifndef _INC_STDEXCPT +#define _INC_STDEXCPT + +#ifdef __cplusplus +#include +#endif + +#endif diff --git a/reactos/include/crt/typeinfo.h b/reactos/include/crt/typeinfo.h new file mode 100644 index 00000000000..68c25bdda76 --- /dev/null +++ b/reactos/include/crt/typeinfo.h @@ -0,0 +1,32 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. + */ +#include <_mingw.h> + +#ifndef _INC_TYPEINFO +#define _INC_TYPEINFO + +#pragma pack(push,_CRT_PACKING) + +#ifndef RC_INVOKED + +#ifndef __cplusplus +#error This header requires a C++ compiler ... +#endif + +#include + +#ifdef __RTTI_OLDNAMES +using std::bad_cast; +using std::bad_typeid; + +typedef type_info Type_info; +typedef bad_cast Bad_cast; +typedef bad_typeid Bad_typeid; +#endif +#endif + +#pragma pack(pop) +#endif diff --git a/reactos/include/crt/varargs.h b/reactos/include/crt/varargs.h new file mode 100644 index 00000000000..bbb60e8456f --- /dev/null +++ b/reactos/include/crt/varargs.h @@ -0,0 +1,12 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. + */ +#ifndef _VARARGS_H +#define _VARARGS_H + +#error "GCC no longer implements ." +#error "Revise your code to use ." + +#endif diff --git a/reactos/include/crt/xlocinfo.h b/reactos/include/crt/xlocinfo.h new file mode 100644 index 00000000000..514ae672e57 --- /dev/null +++ b/reactos/include/crt/xlocinfo.h @@ -0,0 +1,99 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. + */ +#ifndef _XLOCINFO +#define _XLOCINFO +#include +#include +#include +#include + +#pragma pack(push,_CRT_PACKING) + +_C_STD_BEGIN +_C_LIB_DECL + +#define _XA 0x100 +#define _XS 0x000 +#define _BB _CONTROL +#define _CN _SPACE +#define _DI _DIGIT +#define _LO _LOWER +#define _PU _PUNCT +#define _SP _BLANK +#define _UP _UPPER +#define _XD _HEX + +#define _X_ALL LC_ALL +#define _X_COLLATE LC_COLLATE +#define _X_CTYPE LC_CTYPE +#define _X_MONETARY LC_MONETARY +#define _X_NUMERIC LC_NUMERIC +#define _X_TIME LC_TIME +#define _X_MAX LC_MAX +#define _X_MESSAGES 6 +#define _NCAT 7 + +#define _CATMASK(n) ((1 << (n)) >> 1) +#define _M_COLLATE _CATMASK(_X_COLLATE) +#define _M_CTYPE _CATMASK(_X_CTYPE) +#define _M_MONETARY _CATMASK(_X_MONETARY) +#define _M_NUMERIC _CATMASK(_X_NUMERIC) +#define _M_TIME _CATMASK(_X_TIME) +#define _M_MESSAGES _CATMASK(_X_MESSAGES) +#define _M_ALL (_CATMASK(_NCAT) - 1) + +typedef struct _Collvec { + unsigned long _Hand; + unsigned int _Page; +} _Collvec; + +typedef struct _Ctypevec { + unsigned long _Hand; + unsigned int _Page; + const short *_Table; + int _Delfl; +} _Ctypevec; + +typedef struct _Cvtvec { + unsigned long _Hand; + unsigned int _Page; +} _Cvtvec; + +_CRTIMP _Collvec __cdecl _Getcoll(); +_CRTIMP _Ctypevec __cdecl _Getctype(); +_CRTIMP _Cvtvec __cdecl _Getcvt(); +_CRTIMP int __cdecl _Getdateorder(); +_CRTIMP int __cdecl _Mbrtowc(wchar_t *,const char *,size_t,mbstate_t *,const _Cvtvec *); +_CRTIMP float __cdecl _Stof(const char *,char **,long); +_CRTIMP double __cdecl _Stod(const char *,char **,long); +_CRTIMP long double __cdecl _Stold(const char *,char **,long); +_CRTIMP int __cdecl _Strcoll(const char *,const char *,const char *,const char *,const _Collvec *); +_CRTIMP size_t __cdecl _Strxfrm(char *_String1,char *_End1,const char *,const char *,const _Collvec *); +_CRTIMP int __cdecl _Tolower(int,const _Ctypevec *); +_CRTIMP int __cdecl _Toupper(int,const _Ctypevec *); +_CRTIMP int __cdecl _Wcrtomb(char *,wchar_t,mbstate_t *,const _Cvtvec *); +_CRTIMP int __cdecl _Wcscoll(const wchar_t *,const wchar_t *,const wchar_t *,const wchar_t *,const _Collvec *); +_CRTIMP size_t __cdecl _Wcsxfrm(wchar_t *_String1,wchar_t *_End1,const wchar_t *,const wchar_t *,const _Collvec *); +_CRTIMP short __cdecl _Getwctype(wchar_t,const _Ctypevec *); +_CRTIMP const wchar_t *__cdecl _Getwctypes(const wchar_t *,const wchar_t *,short*,const _Ctypevec*); +_CRTIMP wchar_t __cdecl _Towlower(wchar_t,const _Ctypevec *); +_CRTIMP wchar_t __cdecl _Towupper(wchar_t,const _Ctypevec *); +_END_C_LIB_DECL +_C_STD_END + +_C_LIB_DECL +_CRTIMP void *__cdecl _Gettnames(); +_CRTIMP char *__cdecl _Getdays(); +_CRTIMP char *__cdecl _Getmonths(); +_CRTIMP size_t __cdecl _Strftime(char *,size_t _Maxsize,const char *,const struct tm *,void *); +_END_C_LIB_DECL + +_C_LIB_DECL +_locale_t __cdecl _GetLocaleForCP(unsigned int); +_END_C_LIB_DECL + +#pragma pack(pop) +#endif diff --git a/reactos/include/crt/xmath.h b/reactos/include/crt/xmath.h new file mode 100644 index 00000000000..31ad43cc053 --- /dev/null +++ b/reactos/include/crt/xmath.h @@ -0,0 +1,108 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. + */ +#ifndef _XMATH +#define _XMATH +#include +#include +#include +#include + +_C_STD_BEGIN + +#define _DBIAS 0x3fe +#define _DOFF 4 +#define _FBIAS 0x7e +#define _FOFF 7 +#define _FRND 1 + +#define _D0 3 +#define _D1 2 +#define _D2 1 +#define _D3 0 +#define _DLONG 0 +#define _LBIAS 0x3fe +#define _LOFF 4 + +#define _DFRAC ((unsigned short)((1 << _DOFF) - 1)) +#define _DMASK ((unsigned short)(0x7fff & ~_DFRAC)) +#define _DMAX ((unsigned short)((1 << (15 - _DOFF)) - 1)) +#define _DSIGN ((unsigned short)0x8000) +#define DSIGN(x) (((unsigned short *)&(x))[_D0] & _DSIGN) +#define HUGE_EXP (int)(_DMAX *900L / 1000) +#define HUGE_RAD 2.73e9 +#define SAFE_EXP ((unsigned short)(_DMAX >> 1)) + +#define _FFRAC ((unsigned short)((1 << _FOFF) - 1)) +#define _FMASK ((unsigned short)(0x7fff & ~_FFRAC)) +#define _FMAX ((unsigned short)((1 << (15 - _FOFF)) - 1)) +#define _FSIGN ((unsigned short)0x8000) +#define FSIGN(x) (((unsigned short *)&(x))[_F0] & _FSIGN) +#define FHUGE_EXP (int)(_FMAX *900L / 1000) +#define FHUGE_RAD 31.8 +#define FSAFE_EXP ((unsigned short)(_FMAX >> 1)) + +#define _F0 1 +#define _F1 0 + +#define _LFRAC ((unsigned short)(-1)) +#define _LMASK ((unsigned short)0x7fff) +#define _LMAX ((unsigned short)0x7fff) +#define _LSIGN ((unsigned short)0x8000) +#define LSIGN(x) (((unsigned short *)&(x))[_L0] & _LSIGN) +#define LHUGE_EXP (int)(_LMAX *900L / 1000) +#define LHUGE_RAD 2.73e9 +#define LSAFE_EXP ((unsigned short)(_LMAX >> 1)) + +#define _L0 3 +#define _L1 2 +#define _L2 1 +#define _L3 0 +#define _L4 xxx + +#define FINITE _FINITE +#define INF _INFCODE +#define NAN _NANCODE + +#define FL_ERR 0 +#define FL_DEC 1 +#define FL_HEX 2 +#define FL_INF 3 +#define FL_NAN 4 +#define FL_NEG 8 + +_C_LIB_DECL + +_CRTIMP int __cdecl _Stopfx(const char **,char **); +_CRTIMP int __cdecl _Stoflt(const char *,const char *,char **,long[],int); +_CRTIMP int __cdecl _Stoxflt(const char *,const char *,char **,long[],int); +_CRTIMP int __cdecl _WStopfx(const wchar_t **,wchar_t **); +_CRTIMP int __cdecl _WStoflt(const wchar_t *,const wchar_t *,wchar_t **,long[],int); +_CRTIMP int __cdecl _WStoxflt(const wchar_t *,const wchar_t *,wchar_t **,long[],int); +_CRTIMP short __cdecl _Dnorm(unsigned short *); +_CRTIMP short __cdecl _Dscale(double *,long); +_CRTIMP short __cdecl _Dunscale(short *,double *); +_CRTIMP double __cdecl _Poly(double,const double *,int); + +extern _CRTIMP _Dconst _Eps,_Rteps; +extern _CRTIMP double _Xbig; + +_CRTIMP short __cdecl _FDnorm(unsigned short *); +_CRTIMP short __cdecl _FDscale(float *,long); +_CRTIMP short __cdecl _FDunscale(short *,float *); + +extern _CRTIMP _Dconst _FEps,_FRteps; +extern _CRTIMP float _FXbig; + +_CRTIMP short __cdecl _LDnorm(unsigned short *); +_CRTIMP short __cdecl _LDscale(long double *,long); +_CRTIMP short __cdecl _LDunscale(short *,long double *); +_CRTIMP long double __cdecl _LPoly(long double,const long double *,int); + +extern _CRTIMP _Dconst _LEps,_LRteps; +extern _CRTIMP long double _LXbig; +_END_C_LIB_DECL +_C_STD_END +#endif diff --git a/reactos/include/crt/ymath.h b/reactos/include/crt/ymath.h new file mode 100644 index 00000000000..7e7981dd778 --- /dev/null +++ b/reactos/include/crt/ymath.h @@ -0,0 +1,52 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. + */ +#ifndef _YMATH +#define _YMATH +#include +_C_STD_BEGIN +_C_LIB_DECL + +#pragma pack(push,_CRT_PACKING) + +#define _DENORM (-2) +#define _FINITE (-1) +#define _INFCODE 1 +#define _NANCODE 2 + +#define _FE_DIVBYZERO 0x04 +#define _FE_INEXACT 0x20 +#define _FE_INVALID 0x01 +#define _FE_OVERFLOW 0x08 +#define _FE_UNDERFLOW 0x10 + +typedef union { + unsigned short _Word[8]; + float _Float; + double _Double; + long double _Long_double; +} _Dconst; + +void __cdecl _Feraise(int); +_CRTIMP double __cdecl _Cosh(double,double); +_CRTIMP short __cdecl _Dtest(double *); +_CRTIMP short __cdecl _Exp(double *,double,short); +_CRTIMP double __cdecl _Sinh(double,double); +extern _CRTIMP _Dconst _Denorm,_Hugeval,_Inf,_Nan,_Snan; +_CRTIMP float __cdecl _FCosh(float,float); +_CRTIMP short __cdecl _FDtest(float *); +_CRTIMP short __cdecl _FExp(float *,float,short); +_CRTIMP float __cdecl _FSinh(float,float); +extern _CRTIMP _Dconst _FDenorm,_FInf,_FNan,_FSnan; +_CRTIMP long double __cdecl _LCosh(long double,long double); +_CRTIMP short __cdecl _LDtest(long double *); +_CRTIMP short __cdecl _LExp(long double *,long double,short); +_CRTIMP long double __cdecl _LSinh(long double,long double); +extern _CRTIMP _Dconst _LDenorm,_LInf,_LNan,_LSnan; +_END_C_LIB_DECL +_C_STD_END + +#pragma pack(pop) +#endif diff --git a/reactos/include/crt/yvals.h b/reactos/include/crt/yvals.h new file mode 100644 index 00000000000..2ac65cf54a4 --- /dev/null +++ b/reactos/include/crt/yvals.h @@ -0,0 +1,271 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. + */ +#ifndef _YVALS +#define _YVALS + +#include <_mingw.h> + +#pragma pack(push,_CRT_PACKING) + +#define _CPPLIB_VER 405 +#define __PURE_APPDOMAIN_GLOBAL + +#ifndef __CRTDECL +#define __CRTDECL __cdecl +#endif + +#define _WIN32_C_LIB 1 + +#define _MULTI_THREAD 1 +#define _IOSTREAM_OP_LOCKS 1 +#define _GLOBAL_LOCALE 0 + +#define _COMPILER_TLS 1 +#define _TLS_QUAL __declspec(thread) + +#ifndef _HAS_EXCEPTIONS +#define _HAS_EXCEPTIONS 1 +#endif + +#ifndef _HAS_NAMESPACE +#define _HAS_NAMESPACE 1 +#endif + +#ifndef _HAS_IMMUTABLE_SETS +#define _HAS_IMMUTABLE_SETS 0 +#endif + +#ifndef _HAS_STRICT_CONFORMANCE +#define _HAS_STRICT_CONFORMANCE 0 +#endif + +#define _GLOBAL_USING 1 +#define _HAS_ITERATOR_DEBUGGING 0 + +#define __STR2WSTR(str) L##str +#define _STR2WSTR(str) __STR2WSTR(str) + +#define __FILEW__ _STR2WSTR(__FILE__) +#define __FUNCTIONW__ _STR2WSTR(__FUNCTION__) + +#define _SCL_SECURE_INVALID_PARAMETER(expr) ::_invalid_parameter_noinfo() + +#define _SCL_SECURE_INVALID_ARGUMENT_NO_ASSERT _SCL_SECURE_INVALID_PARAMETER("invalid argument") +#define _SCL_SECURE_OUT_OF_RANGE_NO_ASSERT _SCL_SECURE_INVALID_PARAMETER("out of range") +#define _SCL_SECURE_ALWAYS_VALIDATE(cond) { if (!(cond)) { _ASSERTE((#cond,0)); _SCL_SECURE_INVALID_ARGUMENT_NO_ASSERT; } } + +#define _SCL_SECURE_ALWAYS_VALIDATE_RANGE(cond) { if (!(cond)) { _ASSERTE((#cond,0)); _SCL_SECURE_OUT_OF_RANGE_NO_ASSERT; } } + +#define _SCL_SECURE_CRT_VALIDATE(cond,retvalue) { if (!(cond)) { _ASSERTE((#cond,0)); _SCL_SECURE_INVALID_PARAMETER(cond); return (retvalue); } } + +#define _SCL_SECURE_VALIDATE(cond) +#define _SCL_SECURE_VALIDATE_RANGE(cond) + +#define _SCL_SECURE_INVALID_ARGUMENT +#define _SCL_SECURE_OUT_OF_RANGE + +#define _SCL_SECURE_MOVE(func,dst,size,src,count) func((dst),(src),(count)) +#define _SCL_SECURE_COPY(func,dst,size,src,count) func((dst),(src),(count)) + +#define _SECURE_VALIDATION _Secure_validation + +#define _SECURE_VALIDATION_DEFAULT false + +#define _SCL_SECURE_TRAITS_VALIDATE(cond) +#define _SCL_SECURE_TRAITS_VALIDATE_RANGE(cond) + +#define _SCL_SECURE_TRAITS_INVALID_ARGUMENT +#define _SCL_SECURE_TRAITS_OUT_OF_RANGE + +#define _CRT_SECURE_MEMCPY(dest,destsize,source,count) ::memcpy((dest),(source),(count)) +#define _CRT_SECURE_MEMMOVE(dest,destsize,source,count) ::memmove((dest),(source),(count)) +#define _CRT_SECURE_WMEMCPY(dest,destsize,source,count) ::wmemcpy((dest),(source),(count)) +#define _CRT_SECURE_WMEMMOVE(dest,destsize,source,count) ::wmemmove((dest),(source),(count)) + +#ifndef _VC6SP2 +#define _VC6SP2 0 +#endif + +#ifndef _CRTIMP2_NCEEPURE +#define _CRTIMP2_NCEEPURE _CRTIMP +#endif + +#ifndef _MRTIMP2_NPURE +#define _MRTIMP2_NPURE +#endif + +#ifndef _MRTIMP2_NCEE +#define _MRTIMP2_NCEE _CRTIMP +#endif + +#ifndef _MRTIMP2_NCEEPURE +#define _MRTIMP2_NCEEPURE _CRTIMP +#endif + +#ifndef _MRTIMP2_NPURE_NCEEPURE +#define _MRTIMP2_NPURE_NCEEPURE +#endif + +#define _DLL_CPPLIB + +#ifndef _CRTIMP2_PURE +#define _CRTIMP2_PURE _CRTIMP +#endif + +#ifndef _CRTDATA2 +#define _CRTDATA2 _CRTIMP +#endif + +#define _DEPRECATED + +#ifdef __cplusplus +#define _STD_BEGIN namespace std { +#define _STD_END } +#define _STD ::std:: + +#define _STDEXT_BEGIN namespace stdext { +#define _STDEXT_END } +#define _STDEXT ::stdext:: + +#ifdef _STD_USING +#define _C_STD_BEGIN namespace std { +#define _C_STD_END } +#define _CSTD ::std:: +#else + +#define _C_STD_BEGIN +#define _C_STD_END +#define _CSTD :: +#endif + +#define _C_LIB_DECL extern "C" { +#define _END_C_LIB_DECL } +#define _EXTERN_C extern "C" { +#define _END_EXTERN_C } +#else +#define _STD_BEGIN +#define _STD_END +#define _STD + +#define _C_STD_BEGIN +#define _C_STD_END +#define _CSTD + +#define _C_LIB_DECL +#define _END_C_LIB_DECL +#define _EXTERN_C +#define _END_EXTERN_C +#endif + +#define _Restrict restrict + +#ifdef __cplusplus +_STD_BEGIN +typedef bool _Bool; +_STD_END +#endif + +#define _LONGLONG __int64 +#define _ULONGLONG unsigned __int64 +#define _LLONG_MAX 0x7fffffffffffffff +#define _ULLONG_MAX 0xffffffffffffffff + +#define _C2 1 + +#define _MAX_EXP_DIG 8 +#define _MAX_INT_DIG 32 +#define _MAX_SIG_DIG 36 + +typedef _LONGLONG _Longlong; +typedef _ULONGLONG _ULonglong; + +#define _Filet _iobuf + +#ifndef _FPOS_T_DEFINED +#define _FPOSOFF(fp) ((long)(fp)) +#endif + +#define _IOBASE _base +#define _IOPTR _ptr +#define _IOCNT _cnt + +#define _LOCK_LOCALE 0 +#define _LOCK_MALLOC 1 +#define _LOCK_STREAM 2 +#define _LOCK_DEBUG 3 +#define _MAX_LOCK 4 + +#ifdef __cplusplus +_STD_BEGIN + +class _CRTIMP _Lockit { +public: + explicit __thiscall _Lockit(); + explicit __thiscall _Lockit(int); + __thiscall ~_Lockit(); + static void __cdecl _Lockit_ctor(int); + static void __cdecl _Lockit_dtor(int); +private: + static void __cdecl _Lockit_ctor(_Lockit *); + static void __cdecl _Lockit_ctor(_Lockit *,int); + static void __cdecl _Lockit_dtor(_Lockit *); + _Lockit(const _Lockit&); + _Lockit& operator=(const _Lockit&); + int _Locktype; +}; + +#define _BEGIN_LOCK(_Kind) { _STD _Lockit _Lock(_Kind); +#define _END_LOCK() } +#define _BEGIN_LOCINFO(_VarName) { _Locinfo _VarName; +#define _END_LOCINFO() } +#define _RELIABILITY_CONTRACT + +class _CRTIMP _Mutex { +public: + __thiscall _Mutex(); + __thiscall ~_Mutex(); + void __thiscall _Lock(); + void __thiscall _Unlock(); +private: + static void __cdecl _Mutex_ctor(_Mutex *); + static void __cdecl _Mutex_dtor(_Mutex *); + static void __cdecl _Mutex_Lock(_Mutex *); + static void __cdecl _Mutex_Unlock(_Mutex *); + _Mutex(const _Mutex&); + _Mutex& operator=(const _Mutex&); + void *_Mtx; +}; + +class _CRTIMP _Init_locks { +public: + __thiscall _Init_locks(); + __thiscall ~_Init_locks(); +private: + static void __cdecl _Init_locks_ctor(_Init_locks *); + static void __cdecl _Init_locks_dtor(_Init_locks *); +}; + +_STD_END +#endif + +#ifndef _RELIABILITY_CONTRACT +#define _RELIABILITY_CONTRACT +#endif + +_C_STD_BEGIN +_CRTIMP void __cdecl _Atexit(void (__cdecl *)(void)); + +typedef int _Mbstatet; + +#define _ATEXIT_T void +#define _Mbstinit(x) mbstate_t x = {0} +_C_STD_END + +#define _EXTERN_TEMPLATE template +#define _THROW_BAD_ALLOC _THROW1(...) + +#pragma pack(pop) +#endif