public static IntPtr Allocate(ulong size) { if (OperatingSystem.IsWindows()) { return(MemoryManagementWindows.Allocate((IntPtr)size)); } else if (OperatingSystem.IsLinux() || OperatingSystem.IsMacOS()) { return(MemoryManagementUnix.Allocate(size)); } else { throw new PlatformNotSupportedException(); } }
public static IntPtr Allocate(ulong size) { if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) { IntPtr sizeNint = new IntPtr((long)size); return(MemoryManagementWindows.Allocate(sizeNint)); } else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux) || RuntimeInformation.IsOSPlatform(OSPlatform.OSX)) { return(MemoryManagementUnix.Allocate(size)); } else { throw new PlatformNotSupportedException(); } }