diff --git a/SabreTools.Hashing/XxHash/XXH3_128State.cs b/SabreTools.Hashing/XxHash/XXH3_128State.cs index 6726219..9e91d0e 100644 --- a/SabreTools.Hashing/XxHash/XXH3_128State.cs +++ b/SabreTools.Hashing/XxHash/XXH3_128State.cs @@ -1,5 +1,10 @@ namespace SabreTools.Hashing.XxHash { + // Handle unused private fields + #pragma warning disable CS0169 + #pragma warning disable CS0414 + #pragma warning disable CS0649 + /// /// Structure for XXH3 streaming API. /// @@ -9,74 +14,62 @@ namespace SabreTools.Hashing.XxHash /// /// Accumulator lanes /// - public ulong[] AccumulatorLanes { get; } = new ulong[8]; + private readonly ulong[] _acc = new ulong[8]; /// /// Used to store a custom secret generated from a seed. /// - public byte[] CustomSecret { get; set; } = new byte[Constants.XXH3_SECRET_DEFAULT_SIZE]; + private readonly byte[] _customSecret = new byte[Constants.XXH3_SECRET_DEFAULT_SIZE]; /// /// The internal buffer. /// - public byte[] Buffer { get; } = new byte[Constants.XXH3_INTERNALBUFFER_SIZE]; + private readonly byte[] _buffer = new byte[Constants.XXH3_INTERNALBUFFER_SIZE]; /// - /// The amount of memory in , + /// The amount of memory in , /// - public uint BufferedSize { get; set; } + private uint _bufferedSize; /// /// Reserved field. Needed for padding on 64-bit. /// - public uint UseSeed { get; set; } + private uint _useSeed; /// /// Number or stripes processed. /// - public ulong StripesSoFar { get; set; } + private ulong _stripesSoFar; /// /// Total length hashed. 64-bit even on 32-bit targets. /// - public ulong TotalLength { get; set; } + private ulong _totalLength; /// /// Number of stripes per block. /// - public ulong StripesPerBlock { get; set; } + private ulong _stripesPerBlock; /// - /// Size of or + /// Size of or /// - public ulong SecretLimit { get; set; } + private ulong _secretLimit; /// /// Seed for _withSeed variants. Must be zero otherwise, @see XXH3_INITSTATE() /// - public ulong Seed { get; set; } - - /// - /// Reserved field. - /// - public ulong Reserved64 { get; set; } + private ulong _seed; /// /// Reference to an external secret for the _withSecret variants, NULL /// for other variants. /// /// There may be some padding at the end due to alignment on 64 bytes - public byte[]? ExtSecret { get; set; } - - public XXH3_128State() - { - // TODO: XXH3_128bits - Seed = 0; - ExtSecret = null; - } + private byte[]? _extSecret = null; /// The 64-bit seed to alter the hash result predictably. - public XXH3_128State(ulong seed) + public XXH3_128State(ulong seed = 0) { // TODO: XXH3_128bits_withSeed } diff --git a/SabreTools.Hashing/XxHash/XXH3_64State.cs b/SabreTools.Hashing/XxHash/XXH3_64State.cs index 009b3ef..52b5bf8 100644 --- a/SabreTools.Hashing/XxHash/XXH3_64State.cs +++ b/SabreTools.Hashing/XxHash/XXH3_64State.cs @@ -1,5 +1,10 @@ namespace SabreTools.Hashing.XxHash { + // Handle unused private fields + #pragma warning disable CS0169 + #pragma warning disable CS0414 + #pragma warning disable CS0649 + /// /// Structure for XXH3 streaming API. /// @@ -9,64 +14,59 @@ namespace SabreTools.Hashing.XxHash /// /// Accumulator lanes /// - public ulong[] AccumulatorLanes { get; } = new ulong[8]; + private readonly ulong[] _acc = new ulong[8]; /// /// Used to store a custom secret generated from a seed. /// - public byte[] CustomSecret { get; set; } = new byte[Constants.XXH3_SECRET_DEFAULT_SIZE]; + private readonly byte[] _customSecret = new byte[Constants.XXH3_SECRET_DEFAULT_SIZE]; /// /// The internal buffer. /// - public byte[] Buffer { get; } = new byte[Constants.XXH3_INTERNALBUFFER_SIZE]; + private readonly byte[] _buffer = new byte[Constants.XXH3_INTERNALBUFFER_SIZE]; /// - /// The amount of memory in , + /// The amount of memory in , /// - public uint BufferedSize { get; set; } + private uint _bufferedSize; /// /// Reserved field. Needed for padding on 64-bit. /// - public uint UseSeed { get; set; } + private uint _useSeed; /// /// Number or stripes processed. /// - public ulong StripesSoFar { get; set; } + private ulong _stripesSoFar; /// /// Total length hashed. 64-bit even on 32-bit targets. /// - public ulong TotalLength { get; set; } + private ulong _totalLength; /// /// Number of stripes per block. /// - public ulong StripesPerBlock { get; set; } + private ulong _stripesPerBlock; /// - /// Size of or + /// Size of or /// - public ulong SecretLimit { get; set; } + private ulong _secretLimit; /// /// Seed for _withSeed variants. Must be zero otherwise, @see XXH3_INITSTATE() /// - public ulong Seed { get; set; } - - /// - /// Reserved field. - /// - public ulong Reserved64 { get; set; } + private ulong _seed; /// /// Reference to an external secret for the _withSecret variants, NULL /// for other variants. /// /// There may be some padding at the end due to alignment on 64 bytes - public byte[]? ExtSecret { get; set; } + private byte[]? _extSecret = null; public XXH3_64State() {