Only convert value when necessary

This commit is contained in:
Yoshi Askharoun
2023-08-25 14:38:51 -05:00
parent a4c47e611a
commit 7b25639c40
@@ -15,15 +15,20 @@ public class InterpreterObject
{ {
get => _value; get => _value;
set set
{
if (value is byte[] bytes)
{ {
if (Type == typeof(uint)) if (Type == typeof(uint))
_value = BitConverter.ToUInt32((byte[])value, 0); _value = BitConverter.ToUInt32(bytes, 0);
else if (Type == typeof(ulong)) else if (Type == typeof(ulong))
_value = BitConverter.ToUInt64((byte[])value, 0); _value = BitConverter.ToUInt64(bytes, 0);
}
else else
{
_value = value; _value = value;
} }
} }
}
public InstructionObjectSource Source { get; set; } public InstructionObjectSource Source { get; set; }