Skip to content

Commit

Permalink
Merge pull request #82 from youpong/lshift_negative
Browse files Browse the repository at this point in the history
fix left shift of negative value
  • Loading branch information
oetiker authored Nov 9, 2021
2 parents 8c0448a + 9205d1d commit 14290d4
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/CHANGES
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ From: youpong
* remove unused variables from rateup.c
* stop ignoring return value of function fgets
* fix signedness of time_t
* fix left shift of negative value

From: Hilko Bengen <bengen@vdst-ka.inka.de>
* avoid to include global options by default
Expand Down
4 changes: 2 additions & 2 deletions src/src/rateup.c
Original file line number Diff line number Diff line change
Expand Up @@ -1450,7 +1450,7 @@ update (in, out, abs_max, absupdate)
{
inr = diff (in, last.in);
if (inr < 0) {
if (inr > - (long long) 1 << 32) { /* wrapped 32-bit counter? */
if (inr > - ((long long) 1 << 32)) { /* wrapped 32-bit counter? */
inr += (long long) 1 << 32;
}
else {
Expand Down Expand Up @@ -1497,7 +1497,7 @@ update (in, out, abs_max, absupdate)
{
outr = diff (out, last.out);
if (outr < 0) { /* wrapped counter? */
if (outr > - (long long) 1 << 32) {
if (outr > - ((long long) 1 << 32)) {
outr += (long long) 1 << 32;
}
else {
Expand Down

0 comments on commit 14290d4

Please sign in to comment.