20 lines
535 B
C#
20 lines
535 B
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace Assets.Scripts.Devices
|
|
{
|
|
public static class UshortExtensions
|
|
{
|
|
public static ushort GetDifference(this ushort currentVal, ushort previousVal)
|
|
{
|
|
ushort num = (ushort)((uint)currentVal - (uint)previousVal);
|
|
if ((int)previousVal > (int)currentVal)
|
|
num = (ushort)((int)ushort.MaxValue + (int)num + 1);
|
|
return num;
|
|
}
|
|
}
|
|
}
|