Skip to content

Commit d850400

Browse files
committed
Expose INumber<Int512>.Sign().
1 parent b07a607 commit d850400

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

src/MissingValues/Int512.Implementations.cs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -451,6 +451,23 @@ public static Int512 Parse(ReadOnlySpan<byte> utf8Text, IFormatProvider? provide
451451
/// <inheritdoc/>
452452
public static Int512 RotateRight(Int512 value, int rotateAmount) => (value >>> rotateAmount) | (value << (512 - rotateAmount));
453453

454+
/// <inheritdoc/>
455+
public static int Sign(Int512 value)
456+
{
457+
if ((long)value._p7 < 0)
458+
{
459+
return -1;
460+
}
461+
else if (value != Zero)
462+
{
463+
return 1;
464+
}
465+
else
466+
{
467+
return 0;
468+
}
469+
}
470+
454471
/// <inheritdoc/>
455472
public string ToString([StringSyntax(StringSyntaxAttribute.NumericFormat)] string? format, IFormatProvider? formatProvider)
456473
{

0 commit comments

Comments
 (0)