Fix warnings about upcoming C# reserved keywords

This commit is contained in:
2024-07-20 20:45:46 +03:00
parent d879b8e064
commit 8b22ffe007
5 changed files with 49 additions and 61 deletions

View File

@@ -12,7 +12,7 @@ namespace FlaxEngine
[StructLayout(LayoutKind.Sequential, Pack = 4)]
public struct FloatR10G10B10A2
{
private uint value;
private uint rawValue;
/// <summary>
/// Initializes a new instance of the <see cref = "T:FlaxEngine.FloatR10G10B10A2" /> structure.
@@ -23,7 +23,7 @@ namespace FlaxEngine
/// <param name="w">The floating point value that should be stored in A component (2 bit format).</param>
public FloatR10G10B10A2(float x, float y, float z, float w)
{
value = Pack(x, y, z, w);
rawValue = Pack(x, y, z, w);
}
/// <summary>
@@ -33,7 +33,7 @@ namespace FlaxEngine
/// <param name="w">The floating point value that should be stored in alpha component (2 bit format).</param>
public FloatR10G10B10A2(Float3 value, float w = 0)
{
this.value = Pack(value.X, value.Y, value.Z, w);
rawValue = Pack(value.X, value.Y, value.Z, w);
}
/// <summary>
@@ -42,37 +42,33 @@ namespace FlaxEngine
/// <param name = "value">The floating point value that should be stored in 10 bit format.</param>
public FloatR10G10B10A2(Float4 value)
{
this.value = Pack(value.X, value.Y, value.Z, value.W);
rawValue = Pack(value.X, value.Y, value.Z, value.W);
}
/// <summary>
/// Gets or sets the raw 32 bit value used to back this vector.
/// </summary>
public uint RawValue
{
get => value;
set => this.value = value;
}
public uint RawValue => rawValue;
/// <summary>
/// Gets the R component.
/// </summary>
public float R => (value & 0x3FF) / 1023.0f;
public float R => (rawValue & 0x3FF) / 1023.0f;
/// <summary>
/// Gets the G component.
/// </summary>
public float G => ((value >> 10) & 0x3FF) / 1023.0f;
public float G => ((rawValue >> 10) & 0x3FF) / 1023.0f;
/// <summary>
/// Gets the B component.
/// </summary>
public float B => ((value >> 20) & 0x3FF) / 1023.0f;
public float B => ((rawValue >> 20) & 0x3FF) / 1023.0f;
/// <summary>
/// Gets the A component.
/// </summary>
public float A => (value >> 30) / 3.0f;
public float A => (rawValue >> 30) / 3.0f;
/// <summary>
/// Performs an explicit conversion from <see cref = "T:FlaxEngine.Float4" /> to <see cref = "T:FlaxEngine.FloatR10G10B10A2" />.
@@ -102,7 +98,7 @@ namespace FlaxEngine
/// <returns><c>true</c> if <paramref name="left" /> has the same value as <paramref name="right" />; otherwise, <c>false</c>.</returns>
public static bool operator ==(FloatR10G10B10A2 left, FloatR10G10B10A2 right)
{
return left.value == right.value;
return left.rawValue == right.rawValue;
}
/// <summary>
@@ -113,7 +109,7 @@ namespace FlaxEngine
/// <returns><c>true</c> if <paramref name="left" /> has a different value than <paramref name="right" />; otherwise, <c>false</c>.</returns>
public static bool operator !=(FloatR10G10B10A2 left, FloatR10G10B10A2 right)
{
return left.value != right.value;
return left.rawValue != right.rawValue;
}
/// <summary>
@@ -131,7 +127,7 @@ namespace FlaxEngine
/// <returns>A 32-bit signed integer hash code.</returns>
public override int GetHashCode()
{
return value.GetHashCode();
return rawValue.GetHashCode();
}
/// <summary>
@@ -142,7 +138,7 @@ namespace FlaxEngine
/// <returns><c>true</c> if <paramref name = "value1" /> is the same instance as <paramref name = "value2" /> or if both are <c>null</c> references or if <c>value1.Equals(value2)</c> returns <c>true</c>; otherwise, <c>false</c>.</returns>
public static bool Equals(ref FloatR10G10B10A2 value1, ref FloatR10G10B10A2 value2)
{
return value1.value == value2.value;
return value1.rawValue == value2.rawValue;
}
/// <summary>
@@ -152,7 +148,7 @@ namespace FlaxEngine
/// <returns><c>true</c> if the current instance is equal to the specified object; <c>false</c> otherwise.</returns>
public bool Equals(FloatR10G10B10A2 other)
{
return other.value == value;
return other.rawValue == rawValue;
}
/// <summary>
@@ -162,7 +158,7 @@ namespace FlaxEngine
/// <returns><c>true</c> if the current instance is equal to the specified object; <c>false</c> otherwise.</returns>
public override bool Equals(object obj)
{
return obj is FloatR10G10B10A2 other && value == other.value;
return obj is FloatR10G10B10A2 other && rawValue == other.rawValue;
}
private static uint Pack(float x, float y, float z, float w)
@@ -191,11 +187,11 @@ namespace FlaxEngine
{
Float3 vectorOut;
uint tmp = value & 0x3FF;
uint tmp = rawValue & 0x3FF;
vectorOut.X = tmp / 1023.0f;
tmp = (value >> 10) & 0x3FF;
tmp = (rawValue >> 10) & 0x3FF;
vectorOut.Y = tmp / 1023.0f;
tmp = (value >> 20) & 0x3FF;
tmp = (rawValue >> 20) & 0x3FF;
vectorOut.Z = tmp / 1023.0f;
return vectorOut;
@@ -209,13 +205,13 @@ namespace FlaxEngine
{
Float4 vectorOut;
uint tmp = value & 0x3FF;
uint tmp = rawValue & 0x3FF;
vectorOut.X = tmp / 1023.0f;
tmp = (value >> 10) & 0x3FF;
tmp = (rawValue >> 10) & 0x3FF;
vectorOut.Y = tmp / 1023.0f;
tmp = (value >> 20) & 0x3FF;
tmp = (rawValue >> 20) & 0x3FF;
vectorOut.Z = tmp / 1023.0f;
vectorOut.W = (value >> 30) / 3.0f;
vectorOut.W = (rawValue >> 30) / 3.0f;
return vectorOut;
}