Skip to content

Commit e2ac266

Browse files
committed
Simplify StringSpan initialization
Remove unnecessary cast to `(int)` in `StringSpan` constructor. The `length - 1` value is now passed directly, improving code clarity and maintainability. This change ensures type consistency and eliminates redundant operations.
1 parent 9796e06 commit e2ac266

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Hexa.NET.Utilities/StringPool.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public StringSpan Take(ReadOnlySpan<byte> span)
1414
byte* ptr = (byte*)allocator.Alloc(length, 1);
1515
span.CopyTo(new Span<byte>(ptr, span.Length));
1616
ptr[span.Length] = 0;
17-
StringSpan stringSpan = new(ptr, (int)length - 1);
17+
StringSpan stringSpan = new(ptr, length - 1);
1818
var res = strings.AddIt(stringSpan);
1919
if (!res.Added)
2020
{

0 commit comments

Comments
 (0)