Skip to content

Commit 53b4aac

Browse files
committed
cleanup code
1 parent 444d651 commit 53b4aac

File tree

7 files changed

+28
-27
lines changed

7 files changed

+28
-27
lines changed

.editorconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ csharp_style_allow_blank_line_after_colon_in_constructor_initializer_experimenta
131131
csharp_style_allow_blank_line_after_token_in_conditional_expression_experimental = true:silent
132132
csharp_style_allow_blank_line_after_token_in_arrow_expression_clause_experimental = true:silent
133133
csharp_style_prefer_extended_property_pattern = true:suggestion
134+
dotnet_diagnostic.SA1400.severity = silent
134135

135136
[*.vb]
136137
#### Naming styles ####

benchmark/Program.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@ class Program
66
{
77
public static void Main()
88
{
9-
BenchmarkRunner.Run<BenchmarkSuite>();
9+
_ = BenchmarkRunner.Run<BenchmarkSuite>();
1010
}
1111
}

src/MurmurHash3.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -283,13 +283,13 @@ public static byte[] Hash128(ReadOnlySpan<byte> buffer, uint seed)
283283
static byte[] makeBytes(ulong h1, ulong h2)
284284
{
285285
var result = new byte[16];
286-
BitConverter.TryWriteBytes(result, h1);
287-
BitConverter.TryWriteBytes(result.AsSpan()[8..], h2);
286+
_ = BitConverter.TryWriteBytes(result, h1);
287+
_ = BitConverter.TryWriteBytes(result.AsSpan()[8..], h2);
288288
return result;
289289
}
290290

291291
[MethodImpl(MethodImplOptions.AggressiveInlining)]
292-
static void round32(ref uint value, ref uint hash)
292+
static void round32(ref uint value, ref uint hash)
293293
{
294294
const uint c1 = 0xcc9e2d51;
295295
const uint c2 = 0x1b873593;
@@ -301,7 +301,7 @@ static void round32(ref uint value, ref uint hash)
301301
}
302302

303303
[MethodImpl(MethodImplOptions.AggressiveInlining)]
304-
static void round128(
304+
static void round128(
305305
ref ulong k,
306306
ref ulong h,
307307
ulong c1,
@@ -321,7 +321,7 @@ static void round128(
321321
}
322322

323323
[MethodImpl(MethodImplOptions.AggressiveInlining)]
324-
static void fmix64(ref ulong h)
324+
static void fmix64(ref ulong h)
325325
{
326326
h ^= h >> 33;
327327
h *= 0xff51afd7ed558ccdUL;
@@ -331,7 +331,7 @@ static void fmix64(ref ulong h)
331331
}
332332

333333
[MethodImpl(MethodImplOptions.AggressiveInlining)]
334-
static void tailRound128(ref ulong k, ref ulong h, ulong c1, ulong c2, int rot)
334+
static void tailRound128(ref ulong k, ref ulong h, ulong c1, ulong c2, int rot)
335335
{
336336
k *= c1;
337337
k = Bits.RotateLeft(k, rot);

src/SipHash24.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -180,14 +180,14 @@ public static ulong Hash64(ReadOnlySpan<byte> buffer, ReadOnlySpan<byte> key)
180180
}
181181

182182
[MethodImpl(MethodImplOptions.AggressiveInlining)]
183-
static void sipRoundC(ref ulong v0, ref ulong v1, ref ulong v2, ref ulong v3)
183+
static void sipRoundC(ref ulong v0, ref ulong v1, ref ulong v2, ref ulong v3)
184184
{
185185
sipRound(ref v0, ref v1, ref v2, ref v3);
186186
sipRound(ref v0, ref v1, ref v2, ref v3);
187187
}
188188

189189
[MethodImpl(MethodImplOptions.AggressiveInlining)]
190-
static void sipRoundD(ref ulong v0, ref ulong v1, ref ulong v2, ref ulong v3)
190+
static void sipRoundD(ref ulong v0, ref ulong v1, ref ulong v2, ref ulong v3)
191191
{
192192
sipRound(ref v0, ref v1, ref v2, ref v3);
193193
sipRound(ref v0, ref v1, ref v2, ref v3);
@@ -196,7 +196,7 @@ static void sipRoundD(ref ulong v0, ref ulong v1, ref ulong v2, ref ulong v3)
196196
}
197197

198198
[MethodImpl(MethodImplOptions.AggressiveInlining)]
199-
static void sipRound(ref ulong v0, ref ulong v1, ref ulong v2, ref ulong v3)
199+
static void sipRound(ref ulong v0, ref ulong v1, ref ulong v2, ref ulong v3)
200200
{
201201
v0 += v1;
202202
v1 = Bits.RotateLeft(v1, 13);

src/XXHash.cs

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -215,13 +215,13 @@ public static ulong Hash64(Stream stream, ulong seed = 0)
215215
}
216216

217217
[MethodImpl(MethodImplOptions.AggressiveInlining)]
218-
static (ulong Acc1, ulong Acc2, ulong Acc3, ulong Acc4) initAccumulators64(ulong seed)
218+
static (ulong Acc1, ulong Acc2, ulong Acc3, ulong Acc4) initAccumulators64(ulong seed)
219219
{
220220
return (seed + prime64v1 + prime64v2, seed + prime64v2, seed, seed - prime64v1);
221221
}
222222

223223
[MethodImpl(MethodImplOptions.AggressiveInlining)]
224-
static ulong processStripe64(
224+
static ulong processStripe64(
225225
ReadOnlySpan<byte> buf,
226226
ref ulong acc1,
227227
ref ulong acc2,
@@ -246,14 +246,14 @@ static ulong processStripe64(
246246
}
247247

248248
[MethodImpl(MethodImplOptions.AggressiveInlining)]
249-
static void processLane64(ref ulong accn, ReadOnlySpan<byte> buf)
249+
static void processLane64(ref ulong accn, ReadOnlySpan<byte> buf)
250250
{
251251
ulong lane = Bits.ToUInt64(buf);
252252
accn = round64(accn, lane);
253253
}
254254

255255
[MethodImpl(MethodImplOptions.AggressiveInlining)]
256-
static ulong processRemaining64(
256+
static ulong processRemaining64(
257257
ReadOnlySpan<byte> remaining,
258258
ulong acc)
259259
{
@@ -286,7 +286,7 @@ static ulong processRemaining64(
286286
}
287287

288288
[MethodImpl(MethodImplOptions.AggressiveInlining)]
289-
static ulong avalanche64(ulong acc)
289+
static ulong avalanche64(ulong acc)
290290
{
291291
acc ^= acc >> 33;
292292
acc *= prime64v2;
@@ -297,29 +297,29 @@ static ulong avalanche64(ulong acc)
297297
}
298298

299299
[MethodImpl(MethodImplOptions.AggressiveInlining)]
300-
static ulong round64(ulong accn, ulong lane)
300+
static ulong round64(ulong accn, ulong lane)
301301
{
302302
accn += lane * prime64v2;
303303
return Bits.RotateLeft(accn, 31) * prime64v1;
304304
}
305305

306306
[MethodImpl(MethodImplOptions.AggressiveInlining)]
307-
static void mergeAccumulator64(ref ulong acc, ulong accn)
307+
static void mergeAccumulator64(ref ulong acc, ulong accn)
308308
{
309309
acc ^= round64(0, accn);
310310
acc *= prime64v1;
311311
acc += prime64v4;
312312
}
313313

314314
[MethodImpl(MethodImplOptions.AggressiveInlining)]
315-
static (uint Acc1, uint Acc2, uint Acc3, uint Acc4) initAccumulators32(
315+
static (uint Acc1, uint Acc2, uint Acc3, uint Acc4) initAccumulators32(
316316
uint seed)
317317
{
318318
return (seed + prime32v1 + prime32v2, seed + prime32v2, seed, seed - prime32v1);
319319
}
320320

321321
[MethodImpl(MethodImplOptions.AggressiveInlining)]
322-
static uint processStripe32(
322+
static uint processStripe32(
323323
ReadOnlySpan<byte> buf,
324324
ref uint acc1,
325325
ref uint acc2,
@@ -338,14 +338,14 @@ static uint processStripe32(
338338
}
339339

340340
[MethodImpl(MethodImplOptions.AggressiveInlining)]
341-
static void processLane32(ReadOnlySpan<byte> buf, ref uint accn)
341+
static void processLane32(ReadOnlySpan<byte> buf, ref uint accn)
342342
{
343343
uint lane = Bits.ToUInt32(buf);
344344
accn = round32(accn, lane);
345345
}
346346

347347
[MethodImpl(MethodImplOptions.AggressiveInlining)]
348-
static uint processRemaining32(
348+
static uint processRemaining32(
349349
ReadOnlySpan<byte> remaining,
350350
uint acc)
351351
{
@@ -369,7 +369,7 @@ static uint processRemaining32(
369369
}
370370

371371
[MethodImpl(MethodImplOptions.AggressiveInlining)]
372-
static uint round32(uint accn, uint lane)
372+
static uint round32(uint accn, uint lane)
373373
{
374374
accn += lane * prime32v2;
375375
accn = Bits.RotateLeft(accn, 13);
@@ -378,7 +378,7 @@ static uint round32(uint accn, uint lane)
378378
}
379379

380380
[MethodImpl(MethodImplOptions.AggressiveInlining)]
381-
static uint avalanche32(uint acc)
381+
static uint avalanche32(uint acc)
382382
{
383383
acc ^= acc >> 15;
384384
acc *= prime32v2;

test/ChecksumTest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@ public class ChecksumTest
1111
[Test]
1212
public void Test()
1313
{
14-
Checksum.Hash32(array.AsSpan());
14+
Assert.DoesNotThrow(() => Checksum.Hash32(array.AsSpan()));
1515
}
1616
}

test/SipHash24Test.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -126,14 +126,14 @@ public async Task Hash64Async_TestVectors()
126126
public void Hash64Async_InvalidKeyLength_Throws()
127127
{
128128
using var stream = new MemoryStream([]);
129-
Assert.ThrowsAsync<ArgumentException>(async () => await SipHash24.Hash64Async(stream, new byte[15]));
129+
_ = Assert.ThrowsAsync<ArgumentException>(async () => await SipHash24.Hash64Async(stream, new byte[15]));
130130
}
131131

132132
[Test]
133133
public void Hash64_Stream_InvalidKeyLength_Throws()
134134
{
135135
using var stream = new MemoryStream([]);
136-
Assert.Throws<ArgumentException>(() => SipHash24.Hash64(stream, new byte[15]));
136+
_ = Assert.Throws<ArgumentException>(() => SipHash24.Hash64(stream, new byte[15]));
137137
}
138138

139139
static byte[] getIncrementalBuffer(int i)
@@ -154,6 +154,6 @@ public void Hash64_InvalidKeyLength_Throws(int keyLength)
154154
{
155155
var invalidKey = new byte[keyLength];
156156
var buffer = Array.Empty<byte>();
157-
Assert.Throws<ArgumentException>(() => SipHash24.Hash64(buffer, invalidKey));
157+
_ = Assert.Throws<ArgumentException>(() => SipHash24.Hash64(buffer, invalidKey));
158158
}
159159
}

0 commit comments

Comments
 (0)