0F = low guid bitmask
E0 = high guid bitmask
so compress the low guid and then the high guid, it's the same as for 64 bit guids.
Code:
procedure TPacket.PutCompressed(const Value: TWoWGuid);
var
MaskPos: Integer;
i: Byte;
begin
MaskPos := WritePos;
Inc(FWritePos, 2); // add space for 2 masks
for i := 0 to SizeOf(Value.Low) - 1 do
begin
if (Int64Rec(Value.Low).Bytes[i] > 0) then
begin
FBuffer[MaskPos] := FBuffer[MaskPos] or 1 shl i; // low mask
PutUInt8(Int64Rec(Value.Low).Bytes[i]);
end;
end;
for i := 0 to SizeOf(Value.High) - 1 do
begin
if (Int64Rec(Value.High).Bytes[i] > 0) then
begin
FBuffer[MaskPos+1] := FBuffer[MaskPos+1] or 1 shl i; // high mask
PutUInt8(Int64Rec(Value.High).Bytes[i]);
end;
end;
end;