Bug 23438 - XSyncValueSubtract() does not subtract 2 SyncValues properly
XSyncValueSubtract() does not subtract 2 SyncValues properly
Status: RESOLVED FIXED
Product: xorg
Classification: Unclassified
Component: Lib/Xext
7.4 (2008.09)
Other All
: medium normal
Assigned To: Xorg Project Team
Xorg Project Team
http://linuxtesting.org/results/repor...
: patch
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2009-08-21 05:02 UTC by Eduard Bagrov
Modified: 2009-08-22 11:07 UTC (History)
0 users

See Also:


Attachments
The patch for XSyncValueSubtract (499 bytes, patch)
2009-08-21 05:02 UTC, Eduard Bagrov
no flags Details | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Eduard Bagrov 2009-08-21 05:02:31 UTC
Created attachment 28835 [details] [review]
The patch for XSyncValueSubtract

Subtracting the same XSyncValue from XSyncValue, XSyncValueSubtract does not return 0.

XSyncIntToValue(&a, 100); // a.hi = 0, a.lo = 100

XSyncValueSubtract(&result, &a, &a, overflow); 
printf("a.hi = %d, a.lo = %d, overflow = %d", a.hi, a.lo, overflow); 

// a.hi = -1, a.lo = 0 overflow is set to true


In the _XSyncValueSubtract MACRO 

if (t>(presult)->lo) (presult)->hi--;\ 

must be replaced with 

if (t<(presult)->lo) (presult)->hi--;\

Sign '>' with '<'


Subtracting different values also work not in a correct form.
P.S. Copy Paste sometimes work against us.
Comment 1 Julien Cristau 2009-08-22 11:07:42 UTC
fixed in xextproto git, thanks for the report!

commit 55a0bbdde9b27b8dbc6e75d41c51af3f92dea6e3
Author: Eduard Bagrov <ebagrov@linuxtesting.org>
Date:   Fri Aug 21 18:48:19 2009 +0200

    Fix XSyncValueSubtract typo
    
    X.Org bug#23438 <http://bugs.freedesktop.org/show_bug.cgi?id=23438>
    
    Signed-off-by: Julien Cristau <jcristau@debian.org>