in csharp/src/Containers/BinaryAsciiString.cs [921:977]
public BinaryAsciiString Append(UUID uuid, UUIDPrintFormat format = UUIDPrintFormat.UpperCase)
{
char[] hexDigits = (format == UUIDPrintFormat.LowerCase || format == UUIDPrintFormat.LowerCaseWithoutDashes)
? HexDigitsLower : HexDigitsUpper;
Expand(((lastByte + 36) >> 3) + 1);
hashCode = hashCode | 0x40000000;
unsafe
{
fixed (long* ptr = data)
{
byte* bytePtr = (byte*)ptr + lastByte;
switch (format)
{
case UUIDPrintFormat.LowerCase:
case UUIDPrintFormat.UpperCase:
ulong m = uuid.MSB;
ulong l = uuid.LSB;
for (int i = 15; i > 7; i -= 1, bytePtr++)
*(bytePtr) = (byte)hexDigits[(int)(m >> (i * 4)) & 0xF];
*(bytePtr) = (byte)'-';
bytePtr++;
for (int i = 7; i > 3; i -= 1, bytePtr++)
*(bytePtr) = (byte)hexDigits[(int)(m >> (i * 4)) & 0xF];
*(bytePtr) = (byte)'-';
bytePtr++;
for (int i = 3; i >= 0; i -= 1, bytePtr++)
*(bytePtr) = (byte)hexDigits[(int)(m >> (i * 4)) & 0xF];
*(bytePtr) = (byte)'-';
bytePtr++;
for (int i = 15; i > 11; i -= 1, bytePtr++)
*(bytePtr) = (byte)hexDigits[(int)(l >> (i * 4)) & 0xF];
*(bytePtr) = (byte)'-';
bytePtr++;
for (int i = 11; i >= 0; i -= 1, bytePtr++)
*(bytePtr) = (byte)hexDigits[(int)(l >> (i * 4)) & 0xF];
lastByte += 36;
break;
case UUIDPrintFormat.LowerCaseWithoutDashes:
case UUIDPrintFormat.UpperCaseWithoutDashes:
ulong m1 = uuid.MSB;
ulong l1 = uuid.LSB;
for (int i = 15; i >= 0; i -= 1, bytePtr++)
*(bytePtr) = (byte)hexDigits[(int)(m1 >> (i * 4)) & 0xF];
for (int i = 15; i >= 0; i -= 1, bytePtr++)
*(bytePtr) = (byte)hexDigits[(int)(l1 >> (i * 4)) & 0xF];
lastByte += 32;
break;
}
}
}
return this;
}