Skip to content

Commit 4670481

Browse files
committed
Update README
1 parent 2b837ca commit 4670481

File tree

1 file changed

+20
-21
lines changed

1 file changed

+20
-21
lines changed

README.md

Lines changed: 20 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -61,13 +61,24 @@ public readonly partial struct Hp { }
6161
6262
[System.ComponentModel.TypeConverter(typeof(HpTypeConverter))]
6363
public readonly partial struct Hp
64+
: IEquatable<Hp>
6465
#if NET7_0_OR_GREATER
65-
: INumber<A>
66-
#else
67-
: IEquatable<A>
68-
, IComparable<A>
69-
, IComparable
66+
, IEqualityOperators<Hp, Hp, bool>
67+
#endif
68+
, IComparable<Hp>
69+
#if NET7_0_OR_GREATER
70+
, IComparisonOperators<Hp, Hp, bool>
7071
#endif
72+
#if NET7_0_OR_GREATER
73+
, IAdditionOperators<Hp, Hp, Hp>
74+
, ISubtractionOperators<Hp, Hp, Hp>
75+
, IMultiplyOperators<Hp, Hp, Hp>
76+
, IDivisionOperators<Hp, Hp, Hp>
77+
, IUnaryPlusOperators<Hp, Hp>
78+
, IUnaryNegationOperators<Hp, Hp>
79+
, IIncrementOperators<Hp>
80+
, IDecrementOperators<Hp>
81+
#endif
7182
{
7283
readonly int value;
7384

@@ -96,17 +107,6 @@ public readonly partial struct Hp
96107
public static Hp operator --(Hp x) => new Hp(checked((int)(x.value - 1)));
97108
public static Hp operator +(A value) => new((int)(+value.value));
98109
public static Hp operator -(A value) => new((int)(-value.value));
99-
100-
// The .ArithmeticOperator option also generates all members of `System.Numerics.INumber<T>` by default.
101-
#if NET7_0_OR_GREATER
102-
public static Hp AdditiveIdentity => new(global::UnitGenerator.AsNumber<int>.AdditiveIdentity);
103-
public static Hp MultiplicativeIdentity => new(global::UnitGenerator.AsNumber<int>.MultiplicativeIdentity);
104-
public static HP One => new(global::UnitGenerator.AsNumber<int>.One);
105-
public static int Radix => global::UnitGenerator.AsNumber<int>.Radix;
106-
public static Hp Zero => new(global::UnitGenerator.AsNumber<int>.Zero);
107-
public static Hp Abs(Hp value) => new(global::UnitGenerator.AsNumber<int>.Abs(value.value));
108-
// etc......
109-
#endif
110110

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

372372
| Value | Generates |
373373
|-------------------------------------|----------------------------------------------------------------------------------------|
374-
| UnitArithmeticOperators.Addition | `T operator +(T, T)`, `T AdditiveIdentity` |
375-
| UnitArithmeticOperators.Subtraction | `T operator -(T, T)`, `T AdditiveIdentity` |
376-
| UnitArithmeticOperators.Multiply | `T operator *(T, T)`, `T operator +(T)`, `T operator-(T)`, `T MultiplicativeIdentity` |
377-
| UnitArithmeticOperators.Division | `T operator /(T, T)`, `T operator +(T)`, `T operator-(T)`, `T MultiplicativeIdentity` |
374+
| UnitArithmeticOperators.Addition | `T operator +(T, T)` |
375+
| UnitArithmeticOperators.Subtraction | `T operator -(T, T)` |
376+
| UnitArithmeticOperators.Multiply | `T operator *(T, T)`, `T operator +(T)`, `T operator-(T)` |
377+
| UnitArithmeticOperators.Division | `T operator /(T, T)`, `T operator +(T)`, `T operator-(T)` |
378378
| UnitArithmeticOperators.Increment | `T operator ++(T)` |
379379
| UnitArithmeticOperators.Decrement | `T operator --(T)` |
380380

381-
382381
### ValueArithmeticOperator
383382

384383
```csharp

0 commit comments

Comments
 (0)