mirror of
https://github.com/Ardour/ardour.git
synced 2026-01-13 00:46:29 +01:00
Explicitly prevent unsigned int wrap-around
This is a NOOP (0 - 1) + 2 == (0 + 2) - 1 but avoids a unsigned int wrap-wrap around for good measure.
This commit is contained in:
parent
c8205cc6d9
commit
95f8a3aace
1 changed files with 2 additions and 2 deletions
|
|
@ -90,7 +90,7 @@ public:
|
|||
guint rv;
|
||||
|
||||
if (w > r) {
|
||||
rv = (r - w + size) & size_mask;
|
||||
rv = ((r + size) - w) & size_mask;
|
||||
} else if (w < r) {
|
||||
rv = (r - w);
|
||||
} else {
|
||||
|
|
@ -119,7 +119,7 @@ public:
|
|||
if (w > r) {
|
||||
return w - r;
|
||||
} else {
|
||||
return (w - r + size) & size_mask;
|
||||
return ((w + size) - r) & size_mask;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue