[ARMeilleure] Address dotnet-format issues (#5357)
* dotnet format style --severity info Some changes were manually reverted. * dotnet format analyzers --serverity info Some changes have been minimally adapted. * Restore a few unused methods and variables * Silence dotnet format IDE0060 warnings * Silence dotnet format IDE0052 warnings * Address or silence dotnet format IDE1006 warnings * Address or silence dotnet format CA2208 warnings * Address dotnet format CA1822 warnings * Address or silence dotnet format CA1069 warnings * Silence CA1806 and CA1834 issues * Address dotnet format CA1401 warnings * Fix new dotnet-format issues after rebase * Address review comments * Address dotnet format CA2208 warnings properly * Fix formatting for switch expressions * Address most dotnet format whitespace warnings * Apply dotnet format whitespace formatting A few of them have been manually reverted and the corresponding warning was silenced * Add previously silenced warnings back I have no clue how these disappeared * Revert formatting changes for OpCodeTable.cs * Enable formatting for a few cases again * Format if-blocks correctly * Enable formatting for a few more cases again * Fix inline comment alignment * Run dotnet format after rebase and remove unused usings - analyzers - style - whitespace * Disable 'prefer switch expression' rule * Add comments to disabled warnings * Remove a few unused parameters * Adjust namespaces * Simplify properties and array initialization, Use const when possible, Remove trailing commas * Start working on disabled warnings * Fix and silence a few dotnet-format warnings again * Address IDE0251 warnings * Address a few disabled IDE0060 warnings * Silence IDE0060 in .editorconfig * Revert "Simplify properties and array initialization, Use const when possible, Remove trailing commas" This reverts commit 9462e4136c0a2100dc28b20cf9542e06790aa67e. * dotnet format whitespace after rebase * First dotnet format pass * Remove unnecessary formatting exclusion * Add unsafe dotnet format changes * Change visibility of JitSupportDarwin to internal
This commit is contained in:
@@ -19,7 +19,7 @@ namespace ARMeilleure.State
|
||||
/// <summary>
|
||||
/// Gets a new <see cref="V128"/> with all bits set to zero.
|
||||
/// </summary>
|
||||
public static V128 Zero => new V128(0, 0);
|
||||
public static V128 Zero => new(0, 0);
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="V128"/> struct with the specified <see cref="double"/> value
|
||||
@@ -55,9 +55,9 @@ namespace ARMeilleure.State
|
||||
/// <param name="e3">Element 3</param>
|
||||
public V128(float e0, float e1, float e2, float e3)
|
||||
{
|
||||
_e0 = (ulong)(uint)BitConverter.SingleToInt32Bits(e0) << 0;
|
||||
_e0 = (ulong)(uint)BitConverter.SingleToInt32Bits(e0) << 0;
|
||||
_e0 |= (ulong)(uint)BitConverter.SingleToInt32Bits(e1) << 32;
|
||||
_e1 = (ulong)(uint)BitConverter.SingleToInt32Bits(e2) << 0;
|
||||
_e1 = (ulong)(uint)BitConverter.SingleToInt32Bits(e2) << 0;
|
||||
_e1 |= (ulong)(uint)BitConverter.SingleToInt32Bits(e3) << 32;
|
||||
}
|
||||
|
||||
@@ -98,9 +98,9 @@ namespace ARMeilleure.State
|
||||
/// <param name="e3">Element 3</param>
|
||||
public V128(uint e0, uint e1, uint e2, uint e3)
|
||||
{
|
||||
_e0 = (ulong)e0 << 0;
|
||||
_e0 = (ulong)e0 << 0;
|
||||
_e0 |= (ulong)e1 << 32;
|
||||
_e1 = (ulong)e2 << 0;
|
||||
_e1 = (ulong)e2 << 0;
|
||||
_e1 |= (ulong)e3 << 32;
|
||||
}
|
||||
|
||||
@@ -137,7 +137,9 @@ namespace ARMeilleure.State
|
||||
public T Extract<T>(int index) where T : unmanaged
|
||||
{
|
||||
if ((uint)index >= GetElementCount<T>())
|
||||
{
|
||||
ThrowIndexOutOfRange();
|
||||
}
|
||||
|
||||
// Performs:
|
||||
// return *((*T)this + index);
|
||||
@@ -156,7 +158,9 @@ namespace ARMeilleure.State
|
||||
public void Insert<T>(int index, T value) where T : unmanaged
|
||||
{
|
||||
if ((uint)index >= GetElementCount<T>())
|
||||
{
|
||||
ThrowIndexOutOfRange();
|
||||
}
|
||||
|
||||
// Performs:
|
||||
// *((*T)this + index) = value;
|
||||
@@ -167,13 +171,13 @@ namespace ARMeilleure.State
|
||||
/// Returns a new <see cref="byte"/> array which represents the <see cref="V128"/>.
|
||||
/// </summary>
|
||||
/// <returns>A new <see cref="byte"/> array which represents the <see cref="V128"/></returns>
|
||||
public byte[] ToArray()
|
||||
public readonly byte[] ToArray()
|
||||
{
|
||||
byte[] data = new byte[16];
|
||||
byte[] data = new byte[16];
|
||||
Span<byte> span = data;
|
||||
|
||||
BitConverter.TryWriteBytes(span, _e0);
|
||||
BitConverter.TryWriteBytes(span.Slice(8), _e1);
|
||||
BitConverter.TryWriteBytes(span[8..], _e1);
|
||||
|
||||
return data;
|
||||
}
|
||||
@@ -225,7 +229,7 @@ namespace ARMeilleure.State
|
||||
/// </summary>
|
||||
/// <param name="x">Target <see cref="V128"/></param>
|
||||
/// <returns>Result of not operation</returns>
|
||||
public static V128 operator ~(V128 x) => new V128(~x._e0, ~x._e1);
|
||||
public static V128 operator ~(V128 x) => new(~x._e0, ~x._e1);
|
||||
|
||||
/// <summary>
|
||||
/// Performs a bitwise and on the specified <see cref="V128"/> instances.
|
||||
@@ -233,7 +237,7 @@ namespace ARMeilleure.State
|
||||
/// <param name="x">First instance</param>
|
||||
/// <param name="y">Second instance</param>
|
||||
/// <returns>Result of and operation</returns>
|
||||
public static V128 operator &(V128 x, V128 y) => new V128(x._e0 & y._e0, x._e1 & y._e1);
|
||||
public static V128 operator &(V128 x, V128 y) => new(x._e0 & y._e0, x._e1 & y._e1);
|
||||
|
||||
/// <summary>
|
||||
/// Performs a bitwise or on the specified <see cref="V128"/> instances.
|
||||
@@ -241,7 +245,7 @@ namespace ARMeilleure.State
|
||||
/// <param name="x">First instance</param>
|
||||
/// <param name="y">Second instance</param>
|
||||
/// <returns>Result of or operation</returns>
|
||||
public static V128 operator |(V128 x, V128 y) => new V128(x._e0 | y._e0, x._e1 | y._e1);
|
||||
public static V128 operator |(V128 x, V128 y) => new(x._e0 | y._e0, x._e1 | y._e1);
|
||||
|
||||
/// <summary>
|
||||
/// Performs a bitwise exlusive or on the specified <see cref="V128"/> instances.
|
||||
@@ -249,7 +253,7 @@ namespace ARMeilleure.State
|
||||
/// <param name="x">First instance</param>
|
||||
/// <param name="y">Second instance</param>
|
||||
/// <returns>Result of exclusive or operation</returns>
|
||||
public static V128 operator ^(V128 x, V128 y) => new V128(x._e0 ^ y._e0, x._e1 ^ y._e1);
|
||||
public static V128 operator ^(V128 x, V128 y) => new(x._e0 ^ y._e0, x._e1 ^ y._e1);
|
||||
|
||||
/// <summary>
|
||||
/// Determines if the specified <see cref="V128"/> instances are equal.
|
||||
@@ -272,7 +276,7 @@ namespace ARMeilleure.State
|
||||
/// </summary>
|
||||
/// <param name="other">Other <see cref="V128"/> instance</param>
|
||||
/// <returns>true if equal; otherwise false</returns>
|
||||
public bool Equals(V128 other)
|
||||
public readonly bool Equals(V128 other)
|
||||
{
|
||||
return other._e0 == _e0 && other._e1 == _e1;
|
||||
}
|
||||
@@ -282,24 +286,24 @@ namespace ARMeilleure.State
|
||||
/// </summary>
|
||||
/// <param name="obj">Other <see cref="object"/> instance</param>
|
||||
/// <returns>true if equal; otherwise false</returns>
|
||||
public override bool Equals(object obj)
|
||||
public readonly override bool Equals(object obj)
|
||||
{
|
||||
return obj is V128 vector && Equals(vector);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override int GetHashCode()
|
||||
public readonly override int GetHashCode()
|
||||
{
|
||||
return HashCode.Combine(_e0, _e1);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override string ToString()
|
||||
public readonly override string ToString()
|
||||
{
|
||||
return $"0x{_e1:X16}{_e0:X16}";
|
||||
}
|
||||
|
||||
private uint GetElementCount<T>() where T : unmanaged
|
||||
private static uint GetElementCount<T>() where T : unmanaged
|
||||
{
|
||||
return (uint)(Unsafe.SizeOf<V128>() / Unsafe.SizeOf<T>());
|
||||
}
|
||||
@@ -309,4 +313,4 @@ namespace ARMeilleure.State
|
||||
throw new ArgumentOutOfRangeException("index");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user