Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions src/MongoDB.Bson/ObjectModel/Decimal128.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1523,6 +1523,25 @@ public Decimal128(Half value)
}
#endif

/// <summary>
/// Initializes a new instance of the <see cref="Decimal128"/> struct.
/// </summary>
/// <param name="value">The value.</param>
[CLSCompliant(false)]
public Decimal128(sbyte value)
{
if (value >= 0)
{
_highBits = 0;
_lowBits = (ulong)value;
}
else
{
_highBits = Flags.SignBit;
_lowBits = value == sbyte.MinValue ? (ulong)sbyte.MaxValue + 1 : (ulong)-value;
}
}

/// <summary>
/// Initializes a new instance of the <see cref="Decimal128"/> struct.
/// </summary>
Expand Down Expand Up @@ -1559,6 +1578,16 @@ public Decimal128(long value)
}
}

/// <summary>
/// Initializes a new instance of the <see cref="Decimal128"/> struct.
/// </summary>
/// <param name="value">The value.</param>
public Decimal128(byte value)
{
_highBits = 0;
_lowBits = value;
}

/// <summary>
/// Initializes a new instance of the <see cref="Decimal128"/> struct.
/// </summary>
Expand Down