mirror of
https://github.com/StarBeat/UnityDependencyAnalyzer.git
synced 2026-03-08 05:35:27 +08:00
30 lines
616 B
C#
30 lines
616 B
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.IO;
|
|
using System.Linq;
|
|
using System.Net.Http;
|
|
using System.Threading;
|
|
using System.Threading.Tasks;
|
|
|
|
#nullable enable
|
|
using System.Runtime.CompilerServices;
|
|
|
|
namespace MemoryPack.Internal {
|
|
|
|
internal static class MathEx
|
|
{
|
|
const int ArrayMexLength = 0x7FFFFFC7;
|
|
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public static int NewArrayCapacity(int size)
|
|
{
|
|
var newSize = unchecked(size * 2);
|
|
if ((uint)newSize > ArrayMexLength)
|
|
{
|
|
newSize = ArrayMexLength;
|
|
}
|
|
return newSize;
|
|
}
|
|
}
|
|
|
|
} |