mirror of
https://github.com/thebreaddev/Supercell.GUT.git
synced 2024-09-20 09:07:47 +00:00
281d2789ea
not finished. early wip state
47 lines
1.1 KiB
C#
47 lines
1.1 KiB
C#
using Supercell.GUT.Titan.Logic.DataStream;
|
|
|
|
namespace Supercell.GUT.Titan.Logic.Math;
|
|
|
|
public class LogicLong
|
|
{
|
|
public int HigherInt { get; set; }
|
|
public int LowerInt { get; set; }
|
|
|
|
public LogicLong(long longValue)
|
|
{
|
|
this.HigherInt = (int)(longValue >> 32);
|
|
this.LowerInt = (int)longValue;
|
|
}
|
|
|
|
public LogicLong()
|
|
{
|
|
this.HigherInt = 0;
|
|
this.LowerInt = 0;
|
|
}
|
|
|
|
public LogicLong(int higherInt, int lowerInt)
|
|
{
|
|
this.HigherInt = higherInt;
|
|
this.LowerInt = lowerInt;
|
|
}
|
|
|
|
public void Encode(ChecksumEncoder checksumEncoder)
|
|
{
|
|
checksumEncoder.WriteInt(this.HigherInt);
|
|
checksumEncoder.WriteInt(this.LowerInt);
|
|
}
|
|
|
|
public void Decode(ByteStream byteStream)
|
|
{
|
|
this.HigherInt = byteStream.ReadInt();
|
|
this.LowerInt = byteStream.ReadInt();
|
|
}
|
|
|
|
public override bool Equals(object? obj)
|
|
{
|
|
if (obj is LogicLong logicLong)
|
|
return logicLong.HigherInt == this.HigherInt && logicLong.LowerInt == this.LowerInt;
|
|
|
|
return false;
|
|
}
|
|
}
|