Skip to content

Commit

Permalink
Build fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
am11 committed Oct 23, 2024
1 parent 600f8a5 commit f340359
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 39 deletions.
4 changes: 4 additions & 0 deletions src/coreclr/classlibnative/float/divmodint.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

#ifdef TARGET_32BIT

#include <common.h>

#include "divmodint.h"
Expand Down Expand Up @@ -54,3 +56,5 @@ FCIMPL2(uint64_t, COMDivModInt::ModUInt64, uint64_t dividend, uint64_t divisor)

return dividend % divisor;
FCIMPLEND

#endif // TARGET_32BIT
16 changes: 8 additions & 8 deletions src/coreclr/nativeaot/Runtime/MathHelpers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,25 +56,25 @@ FCIMPL1_D(uint32_t, RhpDbl2UInt, double val)
FCIMPLEND

#ifndef HOST_64BIT
EXTERN_C int64_t F_CALL_CONV Math_ActualDivInt64(int64_t i, int64_t j)
EXTERN_C int64_t F_CALL_CONV InternalDivInt64(int64_t i, int64_t j)
{
ASSERT(j && "Divide by zero!");
return i / j;
}

EXTERN_C uint64_t F_CALL_CONV Math_ActualDivUInt64(uint64_t i, uint64_t j)
EXTERN_C uint64_t F_CALL_CONV InternalDivUInt64(uint64_t i, uint64_t j)
{
ASSERT(j && "Divide by zero!");
return i / j;
}

EXTERN_C int64_t F_CALL_CONV Math_ActualModInt64(int64_t i, int64_t j)
EXTERN_C int64_t F_CALL_CONV InternalModInt64(int64_t i, int64_t j)
{
ASSERT(j && "Divide by zero!");
return i % j;
}

EXTERN_C uint64_t F_CALL_CONV Math_ActualModUInt64(uint64_t i, uint64_t j)
EXTERN_C uint64_t F_CALL_CONV InternalModUInt64(uint64_t i, uint64_t j)
{
ASSERT(j && "Divide by zero!");
return i % j;
Expand All @@ -95,25 +95,25 @@ FCIMPLEND
#endif

#ifdef HOST_ARM
EXTERN_C int32_t F_CALL_CONV Math_ActualDivInt32(int32_t i, int32_t j)
EXTERN_C int32_t F_CALL_CONV InternalDivInt32(int32_t i, int32_t j)
{
ASSERT(j && "Divide by zero!");
return i / j;
}

EXTERN_C uint32_t F_CALL_CONV Math_ActualDivUInt32(uint32_t i, uint32_t j)
EXTERN_C uint32_t F_CALL_CONV InternalDivUInt32(uint32_t i, uint32_t j)
{
ASSERT(j && "Divide by zero!");
return i / j;
}

EXTERN_C int32_t F_CALL_CONV Math_ActualModInt32(int32_t i, int32_t j)
EXTERN_C int32_t F_CALL_CONV InternalModInt32(int32_t i, int32_t j)
{
ASSERT(j && "Divide by zero!");
return i % j;
}

EXTERN_C uint32_t F_CALL_CONV Math_ActualModUInt32(uint32_t i, uint32_t j)
EXTERN_C uint32_t F_CALL_CONV InternalModUInt32(uint32_t i, uint32_t j)
{
ASSERT(j && "Divide by zero!");
return i % j;
Expand Down
1 change: 1 addition & 0 deletions src/coreclr/vm/corelib.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#include "comsynchronizable.h"
#include "floatdouble.h"
#include "floatsingle.h"
#include "divmodint.h"
#include "comdatetime.h"
#include "debugdebugger.h"
#include "assemblynative.hpp"
Expand Down
16 changes: 8 additions & 8 deletions src/coreclr/vm/ecalllist.h
Original file line number Diff line number Diff line change
Expand Up @@ -228,14 +228,14 @@ FCFuncStart(gMathFuncs)
FCFuncElement("Tan", COMDouble::Tan)
FCFuncElement("Tanh", COMDouble::Tanh)
#ifdef TARGET_32BIT
FCFuncElement("DivInt32", COMDivModInt::DivInt32)
FCFuncElement("DivUInt32", COMDivModInt::DivUInt32)
FCFuncElement("DivInt64", COMDivModInt::DivInt64)
FCFuncElement("DivUInt64", COMDivModInt::DivUInt64)
FCFuncElement("ModInt32", COMDivModInt::ModInt32)
FCFuncElement("ModUInt32", COMDivModInt::ModUInt32)
FCFuncElement("ModInt64", COMDivModInt::ModInt64)
FCFuncElement("ModUInt64", COMDivModInt::ModUInt64)
FCFuncElement("InternalDivInt32", COMDivModInt::DivInt32)
FCFuncElement("InternalDivUInt32", COMDivModInt::DivUInt32)
FCFuncElement("InternalDivInt64", COMDivModInt::DivInt64)
FCFuncElement("InternalDivUInt64", COMDivModInt::DivUInt64)
FCFuncElement("InternalModInt32", COMDivModInt::ModInt32)
FCFuncElement("InternalModUInt32", COMDivModInt::ModUInt32)
FCFuncElement("InternalModInt64", COMDivModInt::ModInt64)
FCFuncElement("InternalModUInt64", COMDivModInt::ModUInt64)
#endif // TARGET_32BIT
FCFuncEnd()

Expand Down
46 changes: 23 additions & 23 deletions src/libraries/System.Private.CoreLib/src/System/Math.DivModInt.cs
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using System.Diagnostics.CodeAnalysis;
using System.Diagnostics;
using System.Runtime.CompilerServices;

namespace System
{
/// <summary>
/// Provides constants and static methods for trigonometric, logarithmic, and other common mathematical functions.
/// </summary>
public static extern class Math
public static partial class Math
{
[StackTraceHidden]
internal static int DivideInt32(int dividend, int divisor)
internal static int DivInt32(int dividend, int divisor)
{
if ((uint)(divisor + 1) <= 1)
{
Expand All @@ -30,22 +30,22 @@ internal static int DivideInt32(int dividend, int divisor)
}
}

return ActualDivisionInt(dividend, divisor);
return InternalDivInt32(dividend, divisor);
}

[StackTraceHidden]
internal static uint DivideUInt32(uint dividend, uint divisor)
internal static uint DivUInt32(uint dividend, uint divisor)
{
if (divisor == 0)
{
ThrowHelper.ThrowDivideByZeroException();
}

return ActualDivisionUInt(dividend, divisor);
return InternalDivUInt32(dividend, divisor);
}

[StackTraceHidden]
internal static long DivideInt64(long dividend, long divisor)
internal static long DivInt64(long dividend, long divisor)
{
if ((uint)(divisor + 1) <= 1)
{
Expand All @@ -69,11 +69,11 @@ internal static long DivideInt64(long dividend, long divisor)
}
}

return ActualDivisionLong(dividend, divisor);
return InternalDivInt64(dividend, divisor);
}

[StackTraceHidden]
internal static ulong DivideUInt64(ulong dividend, ulong divisor)
internal static ulong DivUInt64(ulong dividend, ulong divisor)
{
if ((divisor >> 32) == 0)
{
Expand All @@ -86,11 +86,11 @@ internal static ulong DivideUInt64(ulong dividend, ulong divisor)
return (uint)dividend / (uint)divisor;
}

return ActualDivisionULong(dividend, divisor);
return InternalDivUInt64(dividend, divisor);
}

[StackTraceHidden]
internal static int ModUInt32(int dividend, int divisor)
internal static int ModInt32(int dividend, int divisor)
{
if ((uint)(divisor + 1) <= 1)
{
Expand All @@ -108,7 +108,7 @@ internal static int ModUInt32(int dividend, int divisor)
}
}

return ActualModulusInt(dividend, divisor);
return InternalModInt32(dividend, divisor);
}

[StackTraceHidden]
Expand All @@ -119,7 +119,7 @@ internal static uint ModUInt32(uint dividend, uint divisor)
ThrowHelper.ThrowDivideByZeroException();
}

return ActualModulusUInt(dividend, divisor);
return InternalModUInt32(dividend, divisor);
}

[StackTraceHidden]
Expand Down Expand Up @@ -147,7 +147,7 @@ internal static long ModInt64(long dividend, long divisor)
}
}

return ActualModulusLong(dividend, divisor);
return InternalModInt64(dividend, divisor);
}

[StackTraceHidden]
Expand All @@ -164,31 +164,31 @@ internal static ulong ModUInt64(ulong dividend, ulong divisor)
return (uint)dividend % (uint)divisor;
}

return ActualModulusULong(dividend, divisor);
return InternalModUInt64(dividend, divisor);
}

[MethodImpl(MethodImplOptions.InternalCall)]
private static extern int ActualDivisionInt32(int dividend, int divisor);
private static extern int InternalDivInt32(int dividend, int divisor);

[MethodImpl(MethodImplOptions.InternalCall)]
private static extern uint ActualDivUInt32(uint dividend, uint divisor);
private static extern uint InternalDivUInt32(uint dividend, uint divisor);

[MethodImpl(MethodImplOptions.InternalCall)]
private static extern long ActualDivInt64(long dividend, long divisor);
private static extern long InternalDivInt64(long dividend, long divisor);

[MethodImpl(MethodImplOptions.InternalCall)]
private static extern ulong ActualDivUInt64(ulong dividend, ulong divisor);
private static extern ulong InternalDivUInt64(ulong dividend, ulong divisor);

[MethodImpl(MethodImplOptions.InternalCall)]
private static extern int ActualModInt32(int dividend, int divisor);
private static extern int InternalModInt32(int dividend, int divisor);

[MethodImpl(MethodImplOptions.InternalCall)]
private static extern uint ActualModUInt32(uint dividend, uint divisor);
private static extern uint InternalModUInt32(uint dividend, uint divisor);

[MethodImpl(MethodImplOptions.InternalCall)]
private static extern long ActualModInt64(long dividend, long divisor);
private static extern long InternalModInt64(long dividend, long divisor);

[MethodImpl(MethodImplOptions.InternalCall)]
private static extern ulong ActualDivInt64(ulong dividend, ulong divisor);
private static extern ulong InternalModUInt64(ulong dividend, ulong divisor);
}
}

0 comments on commit f340359

Please sign in to comment.