Based on the article linked in Filipe's answer (which states the reason to be Delphi carrying out a shr
as opposed to others doing a sar
), here's my take on this:
function CalculatorRsh(Value: Int64; ShiftBits: Integer): Int64;
begin
Result := Value shr ShiftBits;
if (Value and $8000000000000000) > 0 then
Result := Result or ($FFFFFFFFFFFFFFFF shl (64 - ShiftBits));
end;