mirror of
https://github.com/sampletext32/ParkanPlayground.git
synced 2026-08-15 02:57:49 +04:00
fpopov thanks
This commit is contained in:
@@ -3,9 +3,14 @@ using System.Runtime.InteropServices;
|
||||
|
||||
namespace Common;
|
||||
|
||||
/// <summary>DEBUG ONLY. Одни и те же 4 байта, интерпретированные как int32 и float32.</summary>
|
||||
/// <param name="AsInt">Значение как int32.</param>
|
||||
/// <param name="AsFloat">Значение как float32.</param>
|
||||
[DebuggerDisplay("AsInt = {AsInt}, AsFloat = {AsFloat}")]
|
||||
public class IntFloatValue(Span<byte> span)
|
||||
public record class IntFloatValue(int AsInt, float AsFloat)
|
||||
{
|
||||
public int AsInt { get; set; } = MemoryMarshal.Read<int>(span);
|
||||
public float AsFloat { get; set; } = MemoryMarshal.Read<float>(span);
|
||||
}
|
||||
public IntFloatValue(Span<byte> span)
|
||||
: this(MemoryMarshal.Read<int>(span), MemoryMarshal.Read<float>(span))
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user