Sirber
17th September 2004, 23:58
procedure TFBitrate.Button1Click(Sender: TObject);
var
iBitrate: LongWord;
iHours: LongWord;
iMinutes: LongWord;
iSeconds: LongWord;
iMB: LongWord;
begin
// Time
iHours := 0;
iMinutes := 0;
iSeconds := 0;
if (Edit1.Text <> '0') then // Hours
iHours := StrToInt(Edit1.Text) * 60 * 60;
if (Edit2.Text <> '0') then // Minutes
iMinutes := StrToInt(Edit2.Text) * 60;
if (Edit3.Text <> '0') then // Seconds
iSeconds := StrToInt(Edit3.Text);
// MB --> kbps
iMB := StrToInt(Edit5.Text);
iBitrate := (iMB * 1024 * 1024 * 8) div (iHours + iMinutes + iSeconds) div 1000;
// Return
txtBitrate.Text := IntToStr(iBitrate);
end;I'm getting integer overflow. How can I bypass that?
var
iBitrate: LongWord;
iHours: LongWord;
iMinutes: LongWord;
iSeconds: LongWord;
iMB: LongWord;
begin
// Time
iHours := 0;
iMinutes := 0;
iSeconds := 0;
if (Edit1.Text <> '0') then // Hours
iHours := StrToInt(Edit1.Text) * 60 * 60;
if (Edit2.Text <> '0') then // Minutes
iMinutes := StrToInt(Edit2.Text) * 60;
if (Edit3.Text <> '0') then // Seconds
iSeconds := StrToInt(Edit3.Text);
// MB --> kbps
iMB := StrToInt(Edit5.Text);
iBitrate := (iMB * 1024 * 1024 * 8) div (iHours + iMinutes + iSeconds) div 1000;
// Return
txtBitrate.Text := IntToStr(iBitrate);
end;I'm getting integer overflow. How can I bypass that?