anchor.diff:  {%endregion}
   
   {$IFDEF FPC}
  +
   {%region TTimeSpan }
   
   class constructor TTimeSpan.Create;
  
positive.code:     procedure Invoke(sender : TObject; const args: array of Pointer);
    end;
  
    { TArrayTool }
  
    TArrayTool<T> = class
  
negative.code:     Result := LowerCase(Result + IntToHex(Ord(Buffer[n]), 2));
  end;
  
  function Hex2Bytes(const AHexString: AnsiString): TBytes;
  begin
    if NOT TryHex2Bytes(AHexString, Result) then
      raise EArgumentOutOfRangeException.Create('Invalidly formatted hexadecimal string.');
  end;
  
  function TryHex2Bytes(const AHexString: AnsiString; out ABytes : TBytes): boolean; overload;
  var
    P : PAnsiChar;
    LHexString : AnsiString;
    LHexIndex, LHexLength, LHexStart : Integer;
  begin
    SetLength(ABytes, 0);
    LHexLength := System.Length(AHexString);
    LHexStart := 1;
    if AHexString.StartsWith('0x') then begin
      dec(LHexLength, 2);
      inc(LHexStart, 2);
    end;
  
    if (LHexLength MOD 2) <> 0 then
      Exit(false);
  
    if LHexLength = 0 then
      Exit(true);
  
    SetLength(ABytes, LHexLength DIV 2);
    P := @ABytes[Low(ABytes)];
    LHexString := LowerCase(AHexString);
    LHexIndex := HexToBin(PAnsiChar(@LHexString[LHexStart]), P, System.Length(ABytes));
    Result := (LHexIndex = (LHexLength DIV 2));
  end;
  
  function Bytes2Hex(const ABytes: TBytes; AUsePrefix : boolean = false) : AnsiString;
  var
    i, LStart, LLen : Integer;
    s : AnsiString;
    b : Byte;
  begin
    LLen := System.Length(ABytes)*2;
    if AUsePrefix then
      inc(LLen, 2);
  
    System.SetLength(Result, LLen);
    i := 0;
    LStart := 1;
    if AUsePrefix then
      inc(LStart, 2);
  
    if AUsePrefix then begin
      Result[1] := '0';
      Result[2] := 'x';
    end;
  
    for b in ABytes do begin
      s := IntToHex(b,2);
      Result[(i*2)+ LStart] := s[1];
      Result[(i*2)+ LStart + 1] := s[2];
      Inc(i);
    end;
  end;
  
  