Descent3/lib/win/fixwin32.h

68 lines
1.1 KiB
C
Raw Normal View History

2024-04-16 03:43:29 +00:00
/*
* $Logfile: /descent3/main/lib/win/fixwin32.h $
* $Revision: 3 $
* $Date: 2/27/97 4:57p $
* $Author: Samir $
*
* $Log: /descent3/main/lib/win/fixwin32.h $
2024-04-16 18:56:40 +00:00
*
2024-04-16 03:43:29 +00:00
* 3 2/27/97 4:57p Samir
* disabled annoying no return value message for this header.
2024-04-16 18:56:40 +00:00
*
2024-04-16 03:43:29 +00:00
* 2 2/27/97 4:49 PM Jeremy
* fixed a typo
2024-04-16 18:56:40 +00:00
*
2024-04-16 03:43:29 +00:00
* 1 2/27/97 4:45 PM Jeremy
* inline assembly language functions for Intel processor for
* fixmul/fixdiv/fixmuldiv
2024-04-16 18:56:40 +00:00
*
2024-04-16 03:43:29 +00:00
* $NoKeywords: $
*/
#ifndef _FIXWIN32_H
#define _FIXWIN32_H
2024-04-16 18:56:40 +00:00
// what does this do? Why didn't Jason put a comment here?
2024-04-16 03:43:29 +00:00
// Jason replies: This pragma disables the "no return value" warning that
// is generated when converting doubles to floats
// A thousand pardons for the confusion
2024-04-16 18:56:40 +00:00
#pragma warning(disable : 4035)
2024-04-16 03:43:29 +00:00
2024-04-16 18:56:40 +00:00
inline fix FixDiv(fix a, fix b) {
__asm
{
2024-04-16 03:43:29 +00:00
mov eax,a
mov ebx,b
cdq
shld edx, eax, 16
sal eax,16
idiv ebx
2024-04-16 18:56:40 +00:00
}
2024-04-16 03:43:29 +00:00
}
2024-04-16 18:56:40 +00:00
inline fix FixMul(fix a, fix b) {
__asm
{
2024-04-16 03:43:29 +00:00
mov eax,a
mov ebx,b
imul ebx
shrd eax,edx,16
2024-04-16 18:56:40 +00:00
}
2024-04-16 03:43:29 +00:00
}
2024-04-16 18:56:40 +00:00
inline fix FixMulDiv(fix a, fix b, fix c) {
__asm
{
2024-04-16 03:43:29 +00:00
mov eax, a
mov edx, b
mov ebx, c
imul edx
idiv ebx
2024-04-16 18:56:40 +00:00
}
2024-04-16 03:43:29 +00:00
}
2024-04-16 18:56:40 +00:00
#pragma warning(default : 4035)
2024-04-16 03:43:29 +00:00
#endif