Das funktioniert perfekt!
Delphi-Quellcode:
function ConvertBytes(Bytes: UInt64; Multiplier: Integer): UInt64;
const
// When the calculated filesize is bigger than MaxSize, than normalise it to MaxSize.
// I think nobody (not a "normal" person) would ever create a file bigger than 1 EiB
MaxSize: UInt64 = 1152921504606847000; // 1 EiB
begin
if Multiplier> 0 then
Result := UInt64(1) shl (Multiplier* 10)
else
Multiplier:= 1;
Result := Bytes * Result;
if Result > MaxSize then
Result := MaxSize;
end;