38f1ddb...178a853: v0.8.9.1, removed content folder

This commit is contained in:
Joonas Rikkonen
2019-03-18 19:46:58 +02:00
parent 38f1ddb6fe
commit 6c0679c297
1054 changed files with 151673 additions and 144931 deletions
@@ -0,0 +1,40 @@
using System;
using System.Runtime.InteropServices;
using System.Text;
using System.Collections.Generic;
namespace SteamNative
{
internal static class Helpers
{
private static StringBuilder[] StringBuilderPool;
private static int StringBuilderPoolIndex;
/// <summary>
/// Returns a StringBuilder. This will get returned and reused later on.
/// </summary>
public static StringBuilder TakeStringBuilder()
{
if ( StringBuilderPool == null )
{
//
// The pool has 8 items. This should be safe because we shouldn't really
// ever be using more than 2 StringBuilders at the same time.
//
StringBuilderPool = new StringBuilder[8];
for ( int i = 0; i < StringBuilderPool.Length; i++ )
StringBuilderPool[i] = new StringBuilder( 4096 );
}
StringBuilderPoolIndex++;
if ( StringBuilderPoolIndex >= StringBuilderPool.Length )
StringBuilderPoolIndex = 0;
StringBuilderPool[StringBuilderPoolIndex].Capacity = 4096;
StringBuilderPool[StringBuilderPoolIndex].Length = 0;
return StringBuilderPool[StringBuilderPoolIndex];
}
}
}