Mail Archives: djgpp/1998/04/16/11:03:07
From: | "Gerhard W. Gruber" <g DOT gruber AT sis DOT co DOT at>
|
Newsgroups: | comp.os.msdos.djgpp
|
Subject: | Bug in gcc 2.7.2?
|
Date: | Thu, 16 Apr 1998 15:47:00 +0200
|
Organization: | S.I.S. IT
|
Lines: | 39
|
Message-ID: | <35360BD4.5DB6C8C5@sis.co.at>
|
NNTP-Posting-Host: | 192.56.14.75
|
Mime-Version: | 1.0
|
To: | djgpp AT delorie DOT com
|
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp
|
I just encountered a strange thing. I was using a loop that process a buffer.
When the index is outside the buffersize the code should read the next block
from the file and continue. To do this I'm using the modulo operator but there
seems a bug with this.
bl = BufLen % i;
gives following results:
BufLen = 4096
i = 1
bl = 0
i = 2
bl = 0
i = 3
bl = 1 ???????
All variables are unsigned long
I just checked the code and substituted "bl = BufLen % i" with "bl = i / BufLen"
and this works fine.
--
Bye,
Gerhard
Powered by Linux 2.0
email: sparhawk AT eunet DOT at
g DOT gruber AT sis DOT co DOT at
FIDO: Gruber_Gerhard AT 2:310/81.11
Harrison's postulate:
For every action, there is an equal and opposite criticism.
"But this script can't sink!"
"She is made of irony, sir. I assure you, she can. And she will."
- Raw text -