mirror of
https://github.com/tribes2/engine.git
synced 2026-04-20 20:05:22 +00:00
t2 engine svn checkout
This commit is contained in:
commit
ff569bd2ae
988 changed files with 394180 additions and 0 deletions
40
platformX86UNIX/x86UNIXMath_ASM.cc
Normal file
40
platformX86UNIX/x86UNIXMath_ASM.cc
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Torque Game Engine
|
||||
//
|
||||
// Copyright (c) 2001 GarageGames.Com
|
||||
// Portions Copyright (c) 2001 by Sierra Online, Inc.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#include "math/mMath.h"
|
||||
|
||||
static S32 m_mulDivS32_ASM(S32 a, S32 b, S32 c)
|
||||
{ // a * b / c
|
||||
S32 r;
|
||||
|
||||
__asm__ __volatile__(
|
||||
"imul %2\n"
|
||||
"idiv %3\n"
|
||||
: "=a" (r) : "a" (a) , "b" (b) , "c" (c)
|
||||
);
|
||||
return r;
|
||||
}
|
||||
|
||||
|
||||
static U32 m_mulDivU32_ASM(S32 a, S32 b, U32 c)
|
||||
{ // a * b / c
|
||||
S32 r;
|
||||
__asm__ __volatile__(
|
||||
"mov $0, %%edx\n"
|
||||
"mul %2\n"
|
||||
"div %3\n"
|
||||
: "=a" (r) : "a" (a) , "b" (b) , "c" (c)
|
||||
);
|
||||
return r;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
void mInstallLibrary_ASM()
|
||||
{
|
||||
m_mulDivS32 = m_mulDivS32_ASM;
|
||||
m_mulDivU32 = m_mulDivU32_ASM;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue