Skip to content
This repository has been archived by the owner on Jan 23, 2023. It is now read-only.

Commit

Permalink
Merge pull request #9954 from tannergooding/fcall
Browse files Browse the repository at this point in the history
Updating `COMSingle` in `classlibnative` to use the appropriate FCALL declarations.
  • Loading branch information
tannergooding committed Mar 4, 2017
2 parents 6bf345c + 0af0491 commit da2cebb
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 42 deletions.
38 changes: 19 additions & 19 deletions src/classlibnative/float/floatsingle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
/*=====================================Abs=====================================
**
==============================================================================*/
FCIMPL1(float, COMSingle::Abs, float x)
FCIMPL1_V(float, COMSingle::Abs, float x)
FCALL_CONTRACT;

return (float)fabsf(x);
Expand All @@ -58,7 +58,7 @@ FCIMPLEND
/*=====================================Acos=====================================
**
==============================================================================*/
FCIMPL1(float, COMSingle::Acos, float x)
FCIMPL1_V(float, COMSingle::Acos, float x)
FCALL_CONTRACT;

return (float)acosf(x);
Expand All @@ -67,7 +67,7 @@ FCIMPLEND
/*=====================================Asin=====================================
**
==============================================================================*/
FCIMPL1(float, COMSingle::Asin, float x)
FCIMPL1_V(float, COMSingle::Asin, float x)
FCALL_CONTRACT;

return (float)asinf(x);
Expand All @@ -76,7 +76,7 @@ FCIMPLEND
/*=====================================Atan=====================================
**
==============================================================================*/
FCIMPL1(float, COMSingle::Atan, float x)
FCIMPL1_V(float, COMSingle::Atan, float x)
FCALL_CONTRACT;

return (float)atanf(x);
Expand All @@ -85,7 +85,7 @@ FCIMPLEND
/*=====================================Atan2====================================
**
==============================================================================*/
FCIMPL2(float, COMSingle::Atan2, float y, float x)
FCIMPL2_VV(float, COMSingle::Atan2, float y, float x)
FCALL_CONTRACT;

// atan2f(+/-INFINITY, +/-INFINITY) produces +/-0.785398163f (x is +INFINITY) and
Expand All @@ -101,7 +101,7 @@ FCIMPLEND
/*====================================Ceil======================================
**
==============================================================================*/
FCIMPL1(float, COMSingle::Ceil, float x)
FCIMPL1_V(float, COMSingle::Ceil, float x)
FCALL_CONTRACT;

return (float)ceilf(x);
Expand All @@ -110,7 +110,7 @@ FCIMPLEND
/*=====================================Cos======================================
**
==============================================================================*/
FCIMPL1(float, COMSingle::Cos, float x)
FCIMPL1_V(float, COMSingle::Cos, float x)
FCALL_CONTRACT;

return (float)cosf(x);
Expand All @@ -119,7 +119,7 @@ FCIMPLEND
/*=====================================Cosh=====================================
**
==============================================================================*/
FCIMPL1(float, COMSingle::Cosh, float x)
FCIMPL1_V(float, COMSingle::Cosh, float x)
FCALL_CONTRACT;

return (float)coshf(x);
Expand All @@ -128,7 +128,7 @@ FCIMPLEND
/*=====================================Exp======================================
**
==============================================================================*/
FCIMPL1(float, COMSingle::Exp, float x)
FCIMPL1_V(float, COMSingle::Exp, float x)
FCALL_CONTRACT;

return (float)expf(x);
Expand All @@ -137,7 +137,7 @@ FCIMPLEND
/*====================================Floor=====================================
**
==============================================================================*/
FCIMPL1(float, COMSingle::Floor, float x)
FCIMPL1_V(float, COMSingle::Floor, float x)
FCALL_CONTRACT;

return (float)floorf(x);
Expand All @@ -146,7 +146,7 @@ FCIMPLEND
/*=====================================Log======================================
**
==============================================================================*/
FCIMPL1(float, COMSingle::Log, float x)
FCIMPL1_V(float, COMSingle::Log, float x)
FCALL_CONTRACT;

return (float)logf(x);
Expand All @@ -155,7 +155,7 @@ FCIMPLEND
/*====================================Log10=====================================
**
==============================================================================*/
FCIMPL1(float, COMSingle::Log10, float x)
FCIMPL1_V(float, COMSingle::Log10, float x)
FCALL_CONTRACT;

return (float)log10f(x);
Expand All @@ -173,7 +173,7 @@ FCIMPLEND
/*=====================================Pow======================================
**
==============================================================================*/
FCIMPL2(float, COMSingle::Pow, float x, float y)
FCIMPL2_VV(float, COMSingle::Pow, float x, float y)
FCALL_CONTRACT;

// The CRT version of pow preserves the NaN payload of x over the NaN payload of y.
Expand All @@ -200,7 +200,7 @@ FCIMPLEND
/*====================================Round=====================================
**
==============================================================================*/
FCIMPL1(float, COMSingle::Round, float x)
FCIMPL1_V(float, COMSingle::Round, float x)
FCALL_CONTRACT;

// If the number has no fractional part do nothing
Expand All @@ -225,7 +225,7 @@ FCIMPLEND
/*=====================================Sin======================================
**
==============================================================================*/
FCIMPL1(float, COMSingle::Sin, float x)
FCIMPL1_V(float, COMSingle::Sin, float x)
FCALL_CONTRACT;

return (float)sinf(x);
Expand All @@ -234,7 +234,7 @@ FCIMPLEND
/*=====================================Sinh=====================================
**
==============================================================================*/
FCIMPL1(float, COMSingle::Sinh, float x)
FCIMPL1_V(float, COMSingle::Sinh, float x)
FCALL_CONTRACT;

return (float)sinhf(x);
Expand All @@ -243,7 +243,7 @@ FCIMPLEND
/*=====================================Sqrt=====================================
**
==============================================================================*/
FCIMPL1(float, COMSingle::Sqrt, float x)
FCIMPL1_V(float, COMSingle::Sqrt, float x)
FCALL_CONTRACT;

return (float)sqrtf(x);
Expand All @@ -252,7 +252,7 @@ FCIMPLEND
/*=====================================Tan======================================
**
==============================================================================*/
FCIMPL1(float, COMSingle::Tan, float x)
FCIMPL1_V(float, COMSingle::Tan, float x)
FCALL_CONTRACT;

return (float)tanf(x);
Expand All @@ -261,7 +261,7 @@ FCIMPLEND
/*=====================================Tanh=====================================
**
==============================================================================*/
FCIMPL1(float, COMSingle::Tanh, float x)
FCIMPL1_V(float, COMSingle::Tanh, float x)
FCALL_CONTRACT;

return (float)tanhf(x);
Expand Down
38 changes: 19 additions & 19 deletions src/classlibnative/inc/floatsingle.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,26 +10,26 @@

class COMSingle {
public:
FCDECL1(static float, Abs, float x);
FCDECL1(static float, Acos, float x);
FCDECL1(static float, Asin, float x);
FCDECL1(static float, Atan, float x);
FCDECL2(static float, Atan2, float y, float x);
FCDECL1(static float, Ceil, float x);
FCDECL1(static float, Cos, float x);
FCDECL1(static float, Cosh, float x);
FCDECL1(static float, Exp, float x);
FCDECL1(static float, Floor, float x);
FCDECL1(static float, Log, float x);
FCDECL1(static float, Log10, float x);
FCDECL1_V(static float, Abs, float x);
FCDECL1_V(static float, Acos, float x);
FCDECL1_V(static float, Asin, float x);
FCDECL1_V(static float, Atan, float x);
FCDECL2_VV(static float, Atan2, float y, float x);
FCDECL1_V(static float, Ceil, float x);
FCDECL1_V(static float, Cos, float x);
FCDECL1_V(static float, Cosh, float x);
FCDECL1_V(static float, Exp, float x);
FCDECL1_V(static float, Floor, float x);
FCDECL1_V(static float, Log, float x);
FCDECL1_V(static float, Log10, float x);
FCDECL1(static float, ModF, float* iptr);
FCDECL2(static float, Pow, float x, float y);
FCDECL1(static float, Round, float x);
FCDECL1(static float, Sin, float x);
FCDECL1(static float, Sinh, float x);
FCDECL1(static float, Sqrt, float x);
FCDECL1(static float, Tan, float x);
FCDECL1(static float, Tanh, float x);
FCDECL2_VV(static float, Pow, float x, float y);
FCDECL1_V(static float, Round, float x);
FCDECL1_V(static float, Sin, float x);
FCDECL1_V(static float, Sinh, float x);
FCDECL1_V(static float, Sqrt, float x);
FCDECL1_V(static float, Tan, float x);
FCDECL1_V(static float, Tanh, float x);
};

#endif // _FLOATSINGLE_H_
11 changes: 7 additions & 4 deletions src/vm/fcall.h
Original file line number Diff line number Diff line change
Expand Up @@ -138,10 +138,13 @@
// FCThrow(). This is because FCThrow() has to generate an unexecuted
// "return" statement for the code parser.
//
// - If first and/or second argument of your FCall is 64-bit value on x86
// (ie INT64, UINT64 or DOUBLE), you must use "V" versions of FCDECL and
// FCIMPL macros to enregister arguments correctly. For example, FCDECL3_IVI
// must be used for FCalls that take 3 arguments and 2nd argument is INT64.
// - On x86, if first and/or second argument of your FCall cannot be passed
// in either of the __fastcall registers (ECX/EDX), you must use "V" versions
// of FCDECL and FCIMPL macros to enregister arguments correctly. Some of the
// most common types that fit this requirement are 64-bit values (i.e. INT64 or
// UINT64) and floating-point values (i.e. FLOAT or DOUBLE). For example, FCDECL3_IVI
// must be used for FCalls that take 3 arguments and 2nd argument is INT64 and
// FDECL2_VV must be used for FCalls that take 2 arguments where both are FLOAT.
//
// - You may use structs for protecting multiple OBJECTREF's simultaneously.
// In these cases, you must use a variant of a helper method frame with PROTECT
Expand Down

0 comments on commit da2cebb

Please sign in to comment.