Skip to content

Commit 18c385b

Browse files
authored
Switching MathInternal.Min/Max to managed implementations (#2815)
1 parent ac97f68 commit 18c385b

File tree

3 files changed

+10
-41
lines changed

3 files changed

+10
-41
lines changed

src/CLR/CorLib/corlib_native.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -597,8 +597,8 @@ static const CLR_RT_MethodHandler method_lookup[] =
597597
NULL,
598598
NULL,
599599
Library_corlib_native_System_MathInternal::Abs___STATIC__I4__I4,
600-
Library_corlib_native_System_MathInternal::Min___STATIC__I4__I4__I4,
601-
Library_corlib_native_System_MathInternal::Max___STATIC__I4__I4__I4,
600+
NULL,
601+
NULL,
602602
NULL,
603603
NULL,
604604
Library_corlib_native_System_MulticastDelegate::op_Equality___STATIC__BOOLEAN__SystemMulticastDelegate__SystemMulticastDelegate,
@@ -1320,8 +1320,8 @@ static const CLR_RT_MethodHandler method_lookup[] =
13201320
NULL,
13211321
NULL,
13221322
Library_corlib_native_System_MathInternal::Abs___STATIC__I4__I4,
1323-
Library_corlib_native_System_MathInternal::Min___STATIC__I4__I4__I4,
1324-
Library_corlib_native_System_MathInternal::Max___STATIC__I4__I4__I4,
1323+
NULL,
1324+
NULL,
13251325
NULL,
13261326
NULL,
13271327
Library_corlib_native_System_MulticastDelegate::op_Equality___STATIC__BOOLEAN__SystemMulticastDelegate__SystemMulticastDelegate,
@@ -1483,18 +1483,18 @@ const CLR_RT_NativeAssemblyData g_CLR_AssemblyNative_mscorlib =
14831483

14841484
#if (NANOCLR_REFLECTION == TRUE)
14851485

1486-
0xCCE8376E,
1486+
0x445C7AF9,
14871487

14881488
#elif (NANOCLR_REFLECTION == FALSE)
14891489

1490-
0xF60D1B13,
1490+
0xE3A4B52F,
14911491

14921492
#else
14931493
#error "NANOCLR_REFLECTION has to be define either TRUE or FALSE. Check the build options."
14941494
#endif
14951495

14961496
method_lookup,
1497-
{ 100, 5, 0, 18 }
1497+
{ 100, 5, 0, 19 }
14981498
};
14991499

15001500
// clang-format on

src/CLR/CorLib/corlib_native.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -653,8 +653,6 @@ struct Library_corlib_native_System_Guid
653653
struct Library_corlib_native_System_MathInternal
654654
{
655655
NANOCLR_NATIVE_DECLARE(Abs___STATIC__I4__I4);
656-
NANOCLR_NATIVE_DECLARE(Min___STATIC__I4__I4__I4);
657-
NANOCLR_NATIVE_DECLARE(Max___STATIC__I4__I4__I4);
658656

659657
//--//
660658
};

src/CLR/CorLib/corlib_native_System_MathInternal.cpp

Lines changed: 3 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -5,44 +5,15 @@
55
//
66
#include "CorLib.h"
77

8-
HRESULT Library_corlib_native_System_MathInternal::Abs___STATIC__I4__I4( CLR_RT_StackFrame& stack )
8+
HRESULT Library_corlib_native_System_MathInternal::Abs___STATIC__I4__I4(CLR_RT_StackFrame &stack)
99
{
1010
NATIVE_PROFILE_CLR_CORE();
1111
NANOCLR_HEADER();
1212

1313
CLR_INT32 d = stack.Arg0().NumericByRefConst().s4;
14-
CLR_INT32 res = abs( d );
14+
CLR_INT32 res = abs(d);
1515

16-
stack.SetResult_I4( res );
16+
stack.SetResult_I4(res);
1717

1818
NANOCLR_NOCLEANUP_NOLABEL();
1919
}
20-
21-
HRESULT Library_corlib_native_System_MathInternal::Max___STATIC__I4__I4__I4( CLR_RT_StackFrame& stack )
22-
{
23-
NATIVE_PROFILE_CLR_CORE();
24-
NANOCLR_HEADER();
25-
26-
CLR_INT32 x = stack.Arg0().NumericByRefConst().s4;
27-
CLR_INT32 y = stack.Arg1().NumericByRefConst().s4;
28-
CLR_INT32 res = x >= y ? x : y;
29-
30-
stack.SetResult_I4( res );
31-
32-
NANOCLR_NOCLEANUP_NOLABEL();
33-
}
34-
35-
HRESULT Library_corlib_native_System_MathInternal::Min___STATIC__I4__I4__I4( CLR_RT_StackFrame& stack )
36-
{
37-
NATIVE_PROFILE_CLR_CORE();
38-
NANOCLR_HEADER();
39-
40-
CLR_INT32 x = stack.Arg0().NumericByRefConst().s4;
41-
CLR_INT32 y = stack.Arg1().NumericByRefConst().s4;
42-
CLR_INT32 res = x <= y ? x : y;
43-
44-
stack.SetResult_I4( res );
45-
46-
NANOCLR_NOCLEANUP_NOLABEL();
47-
}
48-

0 commit comments

Comments
 (0)