1
0
mirror of https://github.com/alliedmodders/hl2sdk.git synced 2025-09-20 20:46:03 +08:00

Update from SDK 2013

This commit is contained in:
Kenzzer
2025-02-19 18:36:16 -05:00
committed by Nicholas Hastings
parent e0e01948b8
commit ebd971b421
7471 changed files with 2595606 additions and 1256665 deletions

View File

@ -1,64 +1,73 @@
//========= Copyright <20> 1996-2005, Valve Corporation, All rights reserved. ============//
//
// Purpose: linux dependant ASM code for CPU capability detection
//
// $Workfile: $
// $NoKeywords: $
//=============================================================================//
#include <cstdint>
#define cpuid(in,a,b,c,d) \
asm("pushl %%ebx\n\t" "cpuid\n\t" "movl %%ebx,%%esi\n\t" "pop %%ebx": "=a" (a), "=S" (b), "=c" (c), "=d" (d) : "a" (in));
bool CheckMMXTechnology(void)
{
#ifndef PLATFORM_64BITS
uint32_t eax,ebx,edx,unused;
cpuid(1,eax,ebx,unused,edx);
return edx & 0x800000;
#else
return true;
#endif
}
bool CheckSSETechnology(void)
{
#ifndef PLATFORM_64BITS
uint32_t eax,ebx,edx,unused;
cpuid(1,eax,ebx,unused,edx);
return edx & 0x2000000L;
#else
return true;
#endif
}
bool CheckSSE2Technology(void)
{
#ifndef PLATFORM_64BITS
uint32_t eax,ebx,edx,unused;
cpuid(1,eax,ebx,unused,edx);
return edx & 0x04000000;
#else
return true;
#endif
}
bool Check3DNowTechnology(void)
{
#ifndef PLATFORM_64BITS
uint32_t eax, unused;
cpuid(0x80000000,eax,unused,unused,unused);
if ( eax > 0x80000000L )
{
cpuid(0x80000001,unused,unused,unused,eax);
return ( eax & 1<<31 );
}
return false;
#else
return true;
#endif
}
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose: linux dependant ASM code for CPU capability detection
//
// $Workfile: $
// $NoKeywords: $
//=============================================================================//
#ifdef PLATFORM_64BITS
bool CheckMMXTechnology(void)
{
return true;
}
bool CheckSSETechnology(void)
{
return true;
}
bool CheckSSE2Technology(void)
{
return true;
}
bool Check3DNowTechnology(void)
{
return false;
}
#else
#define cpuid(in,a,b,c,d) \
asm("pushl %%ebx\n\t" "cpuid\n\t" "movl %%ebx,%%esi\n\t" "pop %%ebx": "=a" (a), "=S" (b), "=c" (c), "=d" (d) : "a" (in));
bool CheckMMXTechnology(void)
{
unsigned long eax,ebx,edx,unused;
cpuid(1,eax,ebx,unused,edx);
return edx & 0x800000;
}
bool CheckSSETechnology(void)
{
unsigned long eax,ebx,edx,unused;
cpuid(1,eax,ebx,unused,edx);
return edx & 0x2000000L;
}
bool CheckSSE2Technology(void)
{
unsigned long eax,ebx,edx,unused;
cpuid(1,eax,ebx,unused,edx);
return edx & 0x04000000;
}
bool Check3DNowTechnology(void)
{
unsigned long eax, unused;
cpuid(0x80000000,eax,unused,unused,unused);
if ( eax > 0x80000000L )
{
cpuid(0x80000001,unused,unused,unused,eax);
return ( eax & 1<<31 );
}
return false;
}
#endif