public static string Format(ulong size, CalculationBase @base = CalculationBase.Base2, PrintFormat format = PrintFormat.Smart) { if (@base == CalculationBase.Base2) { var searchIndex = Array.BinarySearch(Base2Map, size); if (searchIndex < 0) { searchIndex = ~searchIndex; return(Base2Map[searchIndex].FormatDelegate(size, @base, format)); } return(Base2Map[searchIndex + 1].FormatDelegate(size, @base, format)); } else { var searchIndex = Array.BinarySearch(Base10Map, size); if (searchIndex < 0) { searchIndex = ~searchIndex; return(Base10Map[searchIndex].FormatDelegate(size, @base, format)); } return(Base10Map[searchIndex + 1].FormatDelegate(size, @base, format)); } }
public static string Format(long size, CalculationBase @base = CalculationBase.Base2, PrintFormat format = PrintFormat.Smart) { return(Format((ulong)size, @base, format)); }