Skip to content

Commit 0374d0b

Browse files
committed
WIP
1 parent 5708d91 commit 0374d0b

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

NBitcoin/UInt256.cs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
21
using NBitcoin.DataEncoders;
32
using System;
3+
#if HAS_SPAN
44
using System.Buffers.Binary;
5+
#endif
56
using System.Linq;
67
using System.Runtime.InteropServices;
78

@@ -162,6 +163,10 @@ public override string ToString()
162163
}
163164

164165
#if HAS_SPAN
166+
167+
/// <summary>
168+
/// Returns HEX string representation.
169+
/// </summary>
165170
/// <remarks>The method allocates a new 64 char array.</remarks>
166171
public Span<char> ToSpanString()
167172
{
@@ -171,6 +176,9 @@ public Span<char> ToSpanString()
171176
return result;
172177
}
173178

179+
/// <summary>
180+
/// Returns HEX string representation.
181+
/// </summary>
174182
/// <remarks>The method does not allocate.</remarks>
175183
public void ToSpanString(Span<char> destination)
176184
{
@@ -193,6 +201,7 @@ public void ToSpanString(Span<char> destination)
193201

194202
Span<byte> bytes = MemoryMarshal.Cast<ulong, byte>(ulongs);
195203

204+
// Reverses order of bytes of pn0, pn1, pn2, and pn3 are set in a little endian manner.
196205
for (int i = 31, j = 0; i >= 0; i--, j += 2)
197206
{
198207
HexEncoder.ToCharsBuffer(bytes[i], destination, startingIndex: j);

0 commit comments

Comments
 (0)