Renamed library project, cleaned up code
This commit is contained in:
9
BlendFile/BlendFile.csproj
Normal file
9
BlendFile/BlendFile.csproj
Normal file
@@ -0,0 +1,9 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
||||
34
BlendFile/CompatTypes/uchar.cs
Normal file
34
BlendFile/CompatTypes/uchar.cs
Normal file
@@ -0,0 +1,34 @@
|
||||
using System.Numerics;
|
||||
|
||||
namespace BlendFile.CompatTypes;
|
||||
|
||||
public readonly struct uchar {
|
||||
public uchar Value => _value;
|
||||
|
||||
private readonly byte _value;
|
||||
|
||||
public uchar(byte value) => _value = value;
|
||||
public uchar(uchar value) => _value = value._value;
|
||||
|
||||
public static explicit operator byte(uchar value) => value._value;
|
||||
public static implicit operator uchar(byte value) => new(value);
|
||||
|
||||
public static explicit operator sbyte(uchar value) => (sbyte)value._value;
|
||||
public static implicit operator uchar(sbyte value) => new((byte)value);
|
||||
|
||||
public static explicit operator int(uchar value) => value._value;
|
||||
public static implicit operator uchar(int value) => new((byte)value);
|
||||
|
||||
public static uchar operator +(uchar left, uchar right) => left.Value + right.Value;
|
||||
public static uchar operator -(uchar left, uchar right) => left.Value - right.Value;
|
||||
public static uchar operator *(uchar left, uchar right) => left.Value * right.Value;
|
||||
public static uchar operator /(uchar left, uchar right) => left.Value / right.Value;
|
||||
public static uchar operator %(uchar left, uchar right) => left.Value % right.Value;
|
||||
public static uchar operator &(uchar left, uchar right) => left.Value & right.Value;
|
||||
public static uchar operator |(uchar left, uchar right) => left.Value | right.Value;
|
||||
public static uchar operator ^(uchar left, uchar right) => left.Value ^ right.Value;
|
||||
public static uchar operator <<(uchar left, byte right) => left.Value << right;
|
||||
public static uchar operator >>(uchar left, byte right) => left.Value >> right;
|
||||
public static uchar operator ++(uchar value) => new (value.Value + 1);
|
||||
public static uchar operator --(uchar value) => new (value.Value - 1);
|
||||
}
|
||||
Reference in New Issue
Block a user