Einzelnen Beitrag anzeigen

DieDolly

Registriert seit: 22. Jun 2018
2.175 Beiträge
 
#28

AW: Power funktioniert nicht wie gedacht

  Alt 25. Jul 2018, 01:09
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;

Geändert von DieDolly (25. Jul 2018 um 01:13 Uhr)
  Mit Zitat antworten Zitat