Minor optimizations to string building APIs

このコミットが含まれているのは:
Sergio Pedri committed 2021-10-30 15:11:43 +02:00
1 親 855305cb69
コミット b094a81e32
2ファイル変更
+22 -7

検索条件に一致するファイルはありません

@@ -17,7 +17,11 @@ namespace ComputeSharp.__Internals
{
if (mapping.Add(constant.Key))
{
builder.Append($"#define {constant.Key} {constant.Value}\n");
builder.Append("#define ");
builder.Append(constant.Key);
builder.Append(' ');
builder.Append(constant.Value);
builder.Append('\n');
}
}
}
@@ -33,9 +37,9 @@ namespace ComputeSharp.__Internals
{
if (mapping.Add(type.Key))
{
builder.Append("\n");
builder.Append('\n');
builder.Append(type.Value);
builder.Append("\n");
builder.Append('\n');
}
}
}
@@ -51,9 +55,9 @@ namespace ComputeSharp.__Internals
{
if (mapping.Add(method.Key))
{
builder.Append("\n");
builder.Append('\n');
builder.Append(method.Key);
builder.Append("\n");
builder.Append('\n');
}
}
}
@@ -69,9 +73,9 @@ namespace ComputeSharp.__Internals
{
if (mapping.Remove(method.Key))
{
builder.Append("\n");
builder.Append('\n');
builder.Append(method.Value);
builder.Append("\n");
builder.Append('\n');
}
}
}
+11
ファイルの表示
@@ -48,6 +48,17 @@ namespace ComputeSharp.__Internals
get => new(this.array, 0, this.index);
}
/// <summary>
/// Appends the input character to the current buffer.
/// </summary>
/// <param name="value">The input character to write.</param>
public void Append(char value)
{
EnsureCapacity(1);
this.array[this.index++] = value;
}
/// <summary>
/// Appends the input sequence of characters to the current buffer.
/// </summary>