Skip to content

Commit a2ae152

Browse files
committed
remove default accessibility modifiers
1 parent 65ae7a3 commit a2ae152

File tree

13 files changed

+70
-68
lines changed

13 files changed

+70
-68
lines changed

.editorconfig

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,8 @@ dotnet_diagnostic.SA1009.severity = none
9898
csharp_style_prefer_primary_constructors = true:suggestion
9999
csharp_prefer_system_threading_lock = true:suggestion
100100
csharp_style_prefer_unbound_generic_type_in_nameof = true:suggestion
101+
csharp_style_allow_blank_line_after_token_in_conditional_expression_experimental = true:silent
102+
csharp_style_allow_blank_line_after_token_in_arrow_expression_clause_experimental = true:silent
101103

102104
[*.vb]
103105
#### Naming styles ####
@@ -176,8 +178,8 @@ end_of_line = crlf
176178
dotnet_style_readonly_field = true:suggestion
177179
dotnet_style_predefined_type_for_member_access = true:silent
178180
dotnet_style_predefined_type_for_locals_parameters_members = true:silent
179-
dotnet_style_require_accessibility_modifiers = for_non_interface_members:silent
180-
dotnet_style_allow_multiple_blank_lines_experimental = true:silent
181+
dotnet_style_require_accessibility_modifiers = omit_if_default:warning
182+
dotnet_style_allow_multiple_blank_lines_experimental = false:warning
181183
dotnet_style_allow_statement_immediately_after_block_experimental = true:silent
182184
dotnet_code_quality_unused_parameters = all:suggestion
183185
dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity:suggestion

benchmark/BenchmarkSuite.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ public class BenchmarkSuite
1111

1212
public int Bits;
1313

14-
private static readonly byte[] buf = new byte[BufSize];
15-
private static readonly byte[] sipHashKey = new byte[16];
14+
static readonly byte[] buf = new byte[BufSize];
15+
static readonly byte[] sipHashKey = new byte[16];
1616

1717
#pragma warning disable IDE0079 // Remove unnecessary suppression
1818
#pragma warning disable CA1822 // Mark members as static - BenchmarkDotNet requires these as instance members

src/Bits.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ namespace HashDepot;
1212
/// <summary>
1313
/// Bit operations.
1414
/// </summary>
15-
internal static class Bits
15+
static class Bits
1616
{
1717
[MethodImpl(MethodImplOptions.AggressiveInlining)]
1818
internal static ulong RotateLeft(ulong value, int bits)

src/Checksum.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ namespace HashDepot;
1212
/// <summary>
1313
/// Dummy checksum implementation for benchmark baseline. Don't use in real life.
1414
/// </summary>
15-
internal static class Checksum
15+
static class Checksum
1616
{
1717
public static uint Hash32(ReadOnlySpan<byte> buffer)
1818
{

src/Fnv1a.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@ namespace HashDepot;
1414
/// </summary>
1515
public static class Fnv1a
1616
{
17-
private const uint offsetBasis32 = 2166136261;
18-
private const uint prime32 = 16777619;
17+
const uint offsetBasis32 = 2166136261;
18+
const uint prime32 = 16777619;
1919

20-
private const ulong offsetBasis64 = 14695981039346656037;
21-
private const ulong prime64 = 1099511628211;
20+
const ulong offsetBasis64 = 14695981039346656037;
21+
const ulong prime64 = 1099511628211;
2222

2323
/// <summary>
2424
/// Calculate 32-bit FNV-1a hash value.

src/MurmurHash3.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ public static byte[] Hash128(ReadOnlySpan<byte> buffer, uint seed)
280280
return makeBytes(h1, h2);
281281
}
282282

283-
private static byte[] makeBytes(ulong h1, ulong h2)
283+
static byte[] makeBytes(ulong h1, ulong h2)
284284
{
285285
var result = new byte[16];
286286
BitConverter.TryWriteBytes(result, h1);
@@ -289,7 +289,7 @@ private static byte[] makeBytes(ulong h1, ulong h2)
289289
}
290290

291291
[MethodImpl(MethodImplOptions.AggressiveInlining)]
292-
private 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 @@ private static void round32(ref uint value, ref uint hash)
301301
}
302302

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

323323
[MethodImpl(MethodImplOptions.AggressiveInlining)]
324-
private 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 @@ private static void fmix64(ref ulong h)
331331
}
332332

333333
[MethodImpl(MethodImplOptions.AggressiveInlining)]
334-
private 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: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,14 @@ namespace HashDepot;
1515
/// </summary>
1616
public static class SipHash24
1717
{
18-
private const int keyLength = 16;
18+
const int keyLength = 16;
1919

20-
private const ulong initv0 = 0x736f6d6570736575U;
21-
private const ulong initv1 = 0x646f72616e646f6dU;
22-
private const ulong initv2 = 0x6c7967656e657261U;
23-
private const ulong initv3 = 0x7465646279746573U;
20+
const ulong initv0 = 0x736f6d6570736575U;
21+
const ulong initv1 = 0x646f72616e646f6dU;
22+
const ulong initv2 = 0x6c7967656e657261U;
23+
const ulong initv3 = 0x7465646279746573U;
2424

25-
private const ulong finalVectorXor = 0xFF;
25+
const ulong finalVectorXor = 0xFF;
2626

2727
/// <summary>
2828
/// Calculate 64-bit SipHash-2-4 algorithm using the given key and the input.
@@ -180,14 +180,14 @@ public static ulong Hash64(ReadOnlySpan<byte> buffer, ReadOnlySpan<byte> key)
180180
}
181181

182182
[MethodImpl(MethodImplOptions.AggressiveInlining)]
183-
private 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-
private 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 @@ private static void sipRoundD(ref ulong v0, ref ulong v1, ref ulong v2, ref ulon
196196
}
197197

198198
[MethodImpl(MethodImplOptions.AggressiveInlining)]
199-
private 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: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,17 @@ namespace HashDepot;
1414
/// </summary>
1515
public static class XXHash
1616
{
17-
private const ulong prime64v1 = 11400714785074694791ul;
18-
private const ulong prime64v2 = 14029467366897019727ul;
19-
private const ulong prime64v3 = 1609587929392839161ul;
20-
private const ulong prime64v4 = 9650029242287828579ul;
21-
private const ulong prime64v5 = 2870177450012600261ul;
22-
23-
private const uint prime32v1 = 2654435761u;
24-
private const uint prime32v2 = 2246822519u;
25-
private const uint prime32v3 = 3266489917u;
26-
private const uint prime32v4 = 668265263u;
27-
private const uint prime32v5 = 374761393u;
17+
const ulong prime64v1 = 11400714785074694791ul;
18+
const ulong prime64v2 = 14029467366897019727ul;
19+
const ulong prime64v3 = 1609587929392839161ul;
20+
const ulong prime64v4 = 9650029242287828579ul;
21+
const ulong prime64v5 = 2870177450012600261ul;
22+
23+
const uint prime32v1 = 2654435761u;
24+
const uint prime32v2 = 2246822519u;
25+
const uint prime32v3 = 3266489917u;
26+
const uint prime32v4 = 668265263u;
27+
const uint prime32v5 = 374761393u;
2828

2929
/// <summary>
3030
/// Generate a 32-bit xxHash value.
@@ -215,13 +215,13 @@ public static ulong Hash64(Stream stream, ulong seed = 0)
215215
}
216216

217217
[MethodImpl(MethodImplOptions.AggressiveInlining)]
218-
private 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-
private static ulong processStripe64(
224+
static ulong processStripe64(
225225
ReadOnlySpan<byte> buf,
226226
ref ulong acc1,
227227
ref ulong acc2,
@@ -246,14 +246,14 @@ private static ulong processStripe64(
246246
}
247247

248248
[MethodImpl(MethodImplOptions.AggressiveInlining)]
249-
private 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-
private static ulong processRemaining64(
256+
static ulong processRemaining64(
257257
ReadOnlySpan<byte> remaining,
258258
ulong acc)
259259
{
@@ -286,7 +286,7 @@ private static ulong processRemaining64(
286286
}
287287

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

299299
[MethodImpl(MethodImplOptions.AggressiveInlining)]
300-
private 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-
private 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-
private 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-
private static uint processStripe32(
322+
static uint processStripe32(
323323
ReadOnlySpan<byte> buf,
324324
ref uint acc1,
325325
ref uint acc2,
@@ -338,14 +338,14 @@ private static uint processStripe32(
338338
}
339339

340340
[MethodImpl(MethodImplOptions.AggressiveInlining)]
341-
private 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-
private static uint processRemaining32(
348+
static uint processRemaining32(
349349
ReadOnlySpan<byte> remaining,
350350
uint acc)
351351
{
@@ -369,7 +369,7 @@ private static uint processRemaining32(
369369
}
370370

371371
[MethodImpl(MethodImplOptions.AggressiveInlining)]
372-
private 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 @@ private static uint round32(uint accn, uint lane)
378378
}
379379

380380
[MethodImpl(MethodImplOptions.AggressiveInlining)]
381-
private 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
@@ -6,7 +6,7 @@ namespace HashDepot.Test;
66
[TestFixture]
77
public class ChecksumTest
88
{
9-
private static readonly byte[] array = new byte[1001 * 1003];
9+
static readonly byte[] array = new byte[1001 * 1003];
1010

1111
[Test]
1212
public void Test()

0 commit comments

Comments
 (0)