Skip to content

Commit 1521a97

Browse files
committed
Refactor to use raw strings
1 parent 1f5aebb commit 1521a97

File tree

26 files changed

+150
-140
lines changed

26 files changed

+150
-140
lines changed

Src/FastData.Generator.CPlusPlus.Tests/Vectors/ArrayStructure_String_3.verified.txt

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,10 @@ public:
3232
if ((4611686018427387904ULL & (1ULL << ((key.length() - 1) & 63))) == 0)
3333
return false;
3434
break;
35-
default:
36-
return false;
37-
}
35+
36+
default:
37+
return false;
38+
}
3839

3940
for (size_t i = 0; i < 3; i++)
4041
{

Src/FastData.Generator.CPlusPlus.Tests/Vectors/BinarySearchStructure_String_3.verified.txt

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,10 @@ public:
3232
if ((4611686018427387904ULL & (1ULL << ((key.length() - 1) & 63))) == 0)
3333
return false;
3434
break;
35-
default:
36-
return false;
37-
}
35+
36+
default:
37+
return false;
38+
}
3839

3940
int32_t lo = 0;
4041
int32_t hi = 2;

Src/FastData.Generator.CPlusPlus.Tests/Vectors/HashTableCompactStructure_String_3.verified.txt

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,10 @@ public:
5858
if ((4611686018427387904ULL & (1ULL << ((key.length() - 1) & 63))) == 0)
5959
return false;
6060
break;
61-
default:
62-
return false;
63-
}
61+
62+
default:
63+
return false;
64+
}
6465

6566
const uint64_t hash = get_hash(key);
6667
const size_t index = hash % 3;

Src/FastData.Generator.CPlusPlus.Tests/Vectors/HashTableStructure_String_3.verified.txt

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,10 @@ public:
5555
if ((4611686018427387904ULL & (1ULL << ((key.length() - 1) & 63))) == 0)
5656
return false;
5757
break;
58-
default:
59-
return false;
60-
}
58+
59+
default:
60+
return false;
61+
}
6162

6263
const uint64_t hash = get_hash(key);
6364
const size_t index = hash % 3;

Src/FastData.Generator.CPlusPlus/Internal/Framework/CPlusPlusEarlyExitDef.cs

Lines changed: 22 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -12,34 +12,33 @@ internal class CPlusPlusEarlyExitDef(TypeMap map, CPlusPlusOptions options) : Ea
1212

1313
protected override string GetMaskEarlyExit(MethodType methodType, ulong[] bitSet)
1414
{
15-
if (bitSet.Length == 1)
16-
return RenderWord(bitSet[0], methodType);
17-
18-
StringBuilder sb = new StringBuilder();
19-
20-
sb.Append("""
21-
switch (key.length() >> 6)
22-
{
23-
""");
15+
return bitSet.Length == 1
16+
? RenderWord(bitSet[0], methodType)
17+
: $$"""
18+
switch (key.length() >> 6)
19+
{
20+
{{RenderCases()}}
21+
default:
22+
{{RenderMethod(methodType)}}
23+
}
24+
""";
2425

25-
for (int i = 0; i < bitSet.Length; i++)
26+
string RenderCases()
2627
{
27-
sb.Append($"""
28+
StringBuilder sb = new StringBuilder();
2829

29-
case {i.ToStringInvariant()}:
30-
{RenderWord(bitSet[i], methodType)}
31-
break;
32-
""");
33-
}
30+
for (int i = 0; i < bitSet.Length; i++)
31+
{
32+
sb.Append($"""
33+
case {i.ToStringInvariant()}:
34+
{RenderWord(bitSet[i], methodType)}
35+
break;
3436
35-
sb.Append($$"""
37+
""");
38+
}
3639

37-
default:
38-
{{RenderMethod(methodType)}}
39-
}
40-
""");
41-
42-
return sb.ToString();
40+
return sb.ToString();
41+
}
4342
}
4443

4544
protected override string GetValueEarlyExits<T>(MethodType methodType, T min, T max) =>

Src/FastData.Generator.CSharp.Tests/Features/ObjectSupportTest-ArrayStructure_Int32_3_complex.verified.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ internal static class ArrayStructure_Int32_3_complex
4545
public static bool TryLookup(int key, out Person? value)
4646
{
4747
if (key < 1 || key > 3)
48-
{
48+
{
4949
value = default;
5050
return false;
5151
}

Src/FastData.Generator.CSharp.Tests/Features/ObjectSupportTest-ArrayStructure_Int32_3_simple.verified.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ internal static class ArrayStructure_Int32_3_simple
3232
public static bool TryLookup(int key, out int? value)
3333
{
3434
if (key < 1 || key > 3)
35-
{
35+
{
3636
value = default;
3737
return false;
3838
}

Src/FastData.Generator.CSharp.Tests/Features/ObjectSupportTest-BinarySearchStructure_Int32_3_complex.verified.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ internal static class BinarySearchStructure_Int32_3_complex
5555
public static bool TryLookup(int key, out Person? value)
5656
{
5757
if (key < 1 || key > 3)
58-
{
58+
{
5959
value = default;
6060
return false;
6161
}

Src/FastData.Generator.CSharp.Tests/Features/ObjectSupportTest-BinarySearchStructure_Int32_3_simple.verified.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ internal static class BinarySearchStructure_Int32_3_simple
4242
public static bool TryLookup(int key, out int? value)
4343
{
4444
if (key < 1 || key > 3)
45-
{
45+
{
4646
value = default;
4747
return false;
4848
}

Src/FastData.Generator.CSharp.Tests/Features/ObjectSupportTest-BitSetStructure_Int32_3_complex.verified.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ internal static class BitSetStructure_Int32_3_complex
4141
public static bool TryLookup(int key, out Person value)
4242
{
4343
if (key < 1 || key > 3)
44-
{
44+
{
4545
value = default;
4646
return false;
4747
}

0 commit comments

Comments
 (0)