diff --git a/src/bflat/BuildCommand.cs b/src/bflat/BuildCommand.cs
index e13514e..0ff3ca9 100644
--- a/src/bflat/BuildCommand.cs
+++ b/src/bflat/BuildCommand.cs
@@ -350,8 +350,6 @@ public override int Handle(ParseResult result)
}
string libc = result.GetValueForOption(TargetLibcOption);
- if (targetOS == TargetOS.Windows && targetArchitecture == TargetArchitecture.X86)
- libc ??= "none"; // don't have shcrt for Windows x86 because that one's hacked up
string homePath = CommonOptions.HomePath;
string libPath = Environment.GetEnvironmentVariable("BFLAT_LIB");
@@ -896,7 +894,7 @@ public override int Handle(ParseResult result)
ldArgs.Append("api-ms-win-crt-string-l1-1-0.lib api-ms-win-crt-time-l1-1-0.lib api-ms-win-crt-utility-l1-1-0.lib ");
}
}
- ldArgs.Append("/opt:ref,icf /nodefaultlib:libcpmt.lib /nodefaultlib:libcmt.lib /nodefaultlib:oldnames.lib ");
+ ldArgs.Append("/opt:ref,icf /nodefaultlib:libcpmt.lib /nodefaultlib:libcmt.lib /nodefaultlib:oldnames.lib /nodefaultlib:uuid.lib ");
}
else if (targetOS == TargetOS.Linux)
{
diff --git a/src/bflat/bflat.csproj b/src/bflat/bflat.csproj
index af2fdb8..4d3d6d5 100644
--- a/src/bflat/bflat.csproj
+++ b/src/bflat/bflat.csproj
@@ -10,13 +10,13 @@
- 10.0.0-rc.1.25451.2
+ 10.0.0-rc.1.25527.1
https://github.com/bflattened/runtime/releases/download/
1.3
https://github.com/bflattened/blobs/releases/download/
- 4.8.0-3.final
+ 5.0.0-2.final
diff --git a/src/zerolib/System/Math.cs b/src/zerolib/System/Math.cs
index 34b5c5d..8619461 100644
--- a/src/zerolib/System/Math.cs
+++ b/src/zerolib/System/Math.cs
@@ -14,6 +14,7 @@
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see .
+using System.Runtime;
using System.Runtime.CompilerServices;
namespace System
@@ -43,5 +44,201 @@ internal static ulong ConvertToUInt64Checked(double value)
Environment.FailFast(null);
return 0;
}
+
+ internal static int DivInt32(int dividend, int divisor)
+ {
+ if ((uint)(divisor + 1) <= 1)
+ {
+ if (divisor == 0)
+ {
+ Environment.FailFast(null);
+ return 0;
+ }
+ else if (divisor == -1)
+ {
+ if (dividend == int.MinValue)
+ {
+ Environment.FailFast(null);
+ return 0;
+ }
+ return -dividend;
+ }
+ }
+
+ return DivInt32Internal(dividend, divisor);
+ }
+
+ internal static uint DivUInt32(uint dividend, uint divisor)
+ {
+ if (divisor == 0)
+ {
+ Environment.FailFast(null);
+ return 0;
+ }
+
+ return DivUInt32Internal(dividend, divisor);
+ }
+
+ internal static long DivInt64(long dividend, long divisor)
+ {
+ if ((int)((ulong)divisor >> 32) == (int)(((ulong)(int)divisor) >> 32))
+ {
+ if ((int)divisor == 0)
+ {
+ Environment.FailFast(null);
+ return 0;
+ }
+
+ if ((int)divisor == -1)
+ {
+ if (dividend == long.MinValue)
+ {
+ Environment.FailFast(null);
+ return 0;
+ }
+ return -dividend;
+ }
+
+ if ((int)((ulong)dividend >> 32) == (int)(((ulong)(int)dividend) >> 32))
+ {
+ return DivInt32Internal((int)dividend, (int)divisor);
+ }
+ }
+
+ return DivInt64Internal(dividend, divisor);
+ }
+
+ internal static ulong DivUInt64(ulong dividend, ulong divisor)
+ {
+ if ((int)(divisor >> 32) == 0)
+ {
+ if ((uint)divisor == 0)
+ {
+ Environment.FailFast(null);
+ return 0;
+ }
+
+ if ((int)(dividend >> 32) == 0)
+ {
+ return DivUInt32Internal((uint)dividend, (uint)divisor);
+ }
+ }
+
+ return DivUInt64Internal(dividend, divisor);
+ }
+
+ internal static int ModInt32(int dividend, int divisor)
+ {
+ if ((uint)(divisor + 1) <= 1)
+ {
+ if (divisor == 0)
+ {
+ Environment.FailFast(null);
+ return 0;
+ }
+ else if (divisor == -1)
+ {
+ if (dividend == int.MinValue)
+ {
+ Environment.FailFast(null);
+ return 0;
+ }
+ return 0;
+ }
+ }
+
+ return ModInt32Internal(dividend, divisor);
+ }
+
+ internal static uint ModUInt32(uint dividend, uint divisor)
+ {
+ if (divisor == 0)
+ {
+ Environment.FailFast(null);
+ return 0;
+ }
+
+ return ModUInt32Internal(dividend, divisor);
+ }
+
+ internal static long ModInt64(long dividend, long divisor)
+ {
+ if ((int)((ulong)divisor >> 32) == (int)(((ulong)(int)divisor) >> 32))
+ {
+ if ((int)divisor == 0)
+ {
+ Environment.FailFast(null);
+ return 0;
+ }
+
+ if ((int)divisor == -1)
+ {
+ if (dividend == long.MinValue)
+ {
+ Environment.FailFast(null);
+ return 0;
+ }
+ return 0;
+ }
+
+ if ((int)((ulong)dividend >> 32) == (int)(((ulong)(int)dividend) >> 32))
+ {
+ return ModInt32Internal((int)dividend, (int)divisor);
+ }
+ }
+
+ return ModInt64Internal(dividend, divisor);
+ }
+
+ internal static ulong ModUInt64(ulong dividend, ulong divisor)
+ {
+ if ((int)(divisor >> 32) == 0)
+ {
+ if ((uint)divisor == 0)
+ {
+ Environment.FailFast(null);
+ return 0;
+ }
+
+ if ((int)(dividend >> 32) == 0)
+ {
+ return ModUInt32Internal((uint)dividend, (uint)divisor);
+ }
+ }
+
+ return ModUInt64Internal(dividend, divisor);
+ }
+
+ [MethodImpl(MethodImplOptions.InternalCall)]
+ [RuntimeImport("*", "DivInt32Internal")]
+ private static extern int DivInt32Internal(int dividend, int divisor);
+
+ [MethodImpl(MethodImplOptions.InternalCall)]
+ [RuntimeImport("*", "DivUInt32Internal")]
+ private static extern uint DivUInt32Internal(uint dividend, uint divisor);
+
+ [MethodImpl(MethodImplOptions.InternalCall)]
+ [RuntimeImport("*", "DivInt64Internal")]
+ private static extern long DivInt64Internal(long dividend, long divisor);
+
+ [MethodImpl(MethodImplOptions.InternalCall)]
+ [RuntimeImport("*", "DivUInt64Internal")]
+ private static extern ulong DivUInt64Internal(ulong dividend, ulong divisor);
+
+ [MethodImpl(MethodImplOptions.InternalCall)]
+ [RuntimeImport("*", "ModInt32Internal")]
+ private static extern int ModInt32Internal(int dividend, int divisor);
+
+ [MethodImpl(MethodImplOptions.InternalCall)]
+ [RuntimeImport("*", "ModUInt32Internal")]
+ private static extern uint ModUInt32Internal(uint dividend, uint divisor);
+
+ [MethodImpl(MethodImplOptions.InternalCall)]
+ [RuntimeImport("*", "ModInt64Internal")]
+ private static extern long ModInt64Internal(long dividend, long divisor);
+
+ [MethodImpl(MethodImplOptions.InternalCall)]
+ [RuntimeImport("*", "ModUInt64Internal")]
+ private static extern ulong ModUInt64Internal(ulong dividend, ulong divisor);
}
}
diff --git a/src/zerolib/System/Primitives.cs b/src/zerolib/System/Primitives.cs
index c2fef86..83b40ed 100644
--- a/src/zerolib/System/Primitives.cs
+++ b/src/zerolib/System/Primitives.cs
@@ -26,9 +26,17 @@ public struct SByte { }
public struct Byte { }
public struct Int16 { }
public struct UInt16 { }
- public struct Int32 { }
+ public struct Int32
+ {
+ public const int MaxValue = 0x7fffffff;
+ public const int MinValue = unchecked((int)0x80000000);
+ }
public struct UInt32 { }
- public struct Int64 { }
+ public struct Int64
+ {
+ public const long MaxValue = 0x7fffffffffffffffL;
+ public const long MinValue = unchecked((long)0x8000000000000000L);
+ }
public struct UInt64 { }
public struct IntPtr { }
public struct UIntPtr { }