mirror of https://github.com/debauchee/barrier.git
remove local memcpy from synwinhk
This commit is contained in:
parent
d169555b28
commit
a3ec43999f
|
@ -76,7 +76,6 @@ setImmuneKeys(const DWORD *list, std::size_t size)
|
|||
#else
|
||||
#define assert(_X_) __noop()
|
||||
#endif
|
||||
#pragma function(memcpy)
|
||||
|
||||
//
|
||||
// debugging compile flag. when not zero the server doesn't grab
|
||||
|
@ -655,79 +654,12 @@ DllMain(HINSTANCE instance, DWORD reason, LPVOID)
|
|||
|
||||
extern "C" {
|
||||
|
||||
// VS2005 hack to not link with the CRT
|
||||
#if _MSC_VER >= 1400
|
||||
BOOL WINAPI _DllMainCRTStartup(
|
||||
HINSTANCE instance, DWORD reason, LPVOID lpreserved)
|
||||
{
|
||||
return DllMain(instance, reason, lpreserved);
|
||||
}
|
||||
|
||||
// VS2005 is a bit more bright than VC6 and optimize simple copy loop to
|
||||
// intrinsic memcpy.
|
||||
void * __cdecl memcpy(void * _Dst, const void * _Src, size_t _MaxCount)
|
||||
{
|
||||
void * _DstBackup = _Dst;
|
||||
switch (_MaxCount & 3) {
|
||||
case 3:
|
||||
((char*)_Dst)[0] = ((char*)_Src)[0];
|
||||
++(char*&)_Dst;
|
||||
++(char*&)_Src;
|
||||
--_MaxCount;
|
||||
case 2:
|
||||
((char*)_Dst)[0] = ((char*)_Src)[0];
|
||||
++(char*&)_Dst;
|
||||
++(char*&)_Src;
|
||||
--_MaxCount;
|
||||
case 1:
|
||||
((char*)_Dst)[0] = ((char*)_Src)[0];
|
||||
++(char*&)_Dst;
|
||||
++(char*&)_Src;
|
||||
--_MaxCount;
|
||||
break;
|
||||
case 0:
|
||||
break;
|
||||
|
||||
default:
|
||||
__assume(0);
|
||||
break;
|
||||
}
|
||||
|
||||
// I think it's faster on intel to deference than modify the pointer.
|
||||
const size_t max = _MaxCount / sizeof(UINT_PTR);
|
||||
for (size_t i = 0; i < max; ++i) {
|
||||
((UINT_PTR*)_Dst)[i] = ((UINT_PTR*)_Src)[i];
|
||||
}
|
||||
|
||||
(UINT_PTR*&)_Dst += max;
|
||||
(UINT_PTR*&)_Src += max;
|
||||
|
||||
switch (_MaxCount & 3) {
|
||||
case 3:
|
||||
((char*)_Dst)[0] = ((char*)_Src)[0];
|
||||
++(char*&)_Dst;
|
||||
++(char*&)_Src;
|
||||
case 2:
|
||||
((char*)_Dst)[0] = ((char*)_Src)[0];
|
||||
++(char*&)_Dst;
|
||||
++(char*&)_Src;
|
||||
case 1:
|
||||
((char*)_Dst)[0] = ((char*)_Src)[0];
|
||||
++(char*&)_Dst;
|
||||
++(char*&)_Src;
|
||||
break;
|
||||
case 0:
|
||||
break;
|
||||
|
||||
default:
|
||||
__assume(0);
|
||||
break;
|
||||
}
|
||||
|
||||
return _DstBackup;
|
||||
}
|
||||
#endif
|
||||
|
||||
int
|
||||
init(DWORD threadID)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue