Skip to content

Commit

Permalink
Update README
Browse files Browse the repository at this point in the history
  • Loading branch information
hadashiA committed Aug 17, 2023
1 parent 2b837ca commit 4670481
Showing 1 changed file with 20 additions and 21 deletions.
41 changes: 20 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,24 @@ public readonly partial struct Hp { }
[System.ComponentModel.TypeConverter(typeof(HpTypeConverter))]
public readonly partial struct Hp
: IEquatable<Hp>
#if NET7_0_OR_GREATER
: INumber<A>
#else
: IEquatable<A>
, IComparable<A>
, IComparable
, IEqualityOperators<Hp, Hp, bool>
#endif
, IComparable<Hp>
#if NET7_0_OR_GREATER
, IComparisonOperators<Hp, Hp, bool>
#endif
#if NET7_0_OR_GREATER
, IAdditionOperators<Hp, Hp, Hp>
, ISubtractionOperators<Hp, Hp, Hp>
, IMultiplyOperators<Hp, Hp, Hp>
, IDivisionOperators<Hp, Hp, Hp>
, IUnaryPlusOperators<Hp, Hp>
, IUnaryNegationOperators<Hp, Hp>
, IIncrementOperators<Hp>
, IDecrementOperators<Hp>
#endif
{
readonly int value;

Expand Down Expand Up @@ -96,17 +107,6 @@ public readonly partial struct Hp
public static Hp operator --(Hp x) => new Hp(checked((int)(x.value - 1)));
public static Hp operator +(A value) => new((int)(+value.value));
public static Hp operator -(A value) => new((int)(-value.value));

// The .ArithmeticOperator option also generates all members of `System.Numerics.INumber<T>` by default.
#if NET7_0_OR_GREATER
public static Hp AdditiveIdentity => new(global::UnitGenerator.AsNumber<int>.AdditiveIdentity);
public static Hp MultiplicativeIdentity => new(global::UnitGenerator.AsNumber<int>.MultiplicativeIdentity);
public static HP One => new(global::UnitGenerator.AsNumber<int>.One);
public static int Radix => global::UnitGenerator.AsNumber<int>.Radix;
public static Hp Zero => new(global::UnitGenerator.AsNumber<int>.Zero);
public static Hp Abs(Hp value) => new(global::UnitGenerator.AsNumber<int>.Abs(value.value));
// etc......
#endif

// UnitGenerateOptions.ValueArithmeticOperator
public static Hp operator +(Hp x, in int y) => new Hp(checked((int)(x.value + y)));
Expand Down Expand Up @@ -371,14 +371,13 @@ public readonly partial struct Hp { }

| Value | Generates |
|-------------------------------------|----------------------------------------------------------------------------------------|
| UnitArithmeticOperators.Addition | `T operator +(T, T)`, `T AdditiveIdentity` |
| UnitArithmeticOperators.Subtraction | `T operator -(T, T)`, `T AdditiveIdentity` |
| UnitArithmeticOperators.Multiply | `T operator *(T, T)`, `T operator +(T)`, `T operator-(T)`, `T MultiplicativeIdentity` |
| UnitArithmeticOperators.Division | `T operator /(T, T)`, `T operator +(T)`, `T operator-(T)`, `T MultiplicativeIdentity` |
| UnitArithmeticOperators.Addition | `T operator +(T, T)` |
| UnitArithmeticOperators.Subtraction | `T operator -(T, T)` |
| UnitArithmeticOperators.Multiply | `T operator *(T, T)`, `T operator +(T)`, `T operator-(T)` |
| UnitArithmeticOperators.Division | `T operator /(T, T)`, `T operator +(T)`, `T operator-(T)` |
| UnitArithmeticOperators.Increment | `T operator ++(T)` |
| UnitArithmeticOperators.Decrement | `T operator --(T)` |


### ValueArithmeticOperator

```csharp
Expand Down

0 comments on commit 4670481

Please sign in to comment.