Bug 23438

Summary: XSyncValueSubtract() does not subtract 2 SyncValues properly
Product: xorg Reporter: Eduard Bagrov <ebagrov>
Component: Lib/XextAssignee: Xorg Project Team <xorg-team>
Status: RESOLVED FIXED QA Contact: Xorg Project Team <xorg-team>
Severity: normal    
Priority: medium Keywords: patch
Version: 7.4 (2008.09)   
Hardware: Other   
OS: All   
URL: http://linuxtesting.org/results/report?num=D0131
Whiteboard:
i915 platform: i915 features:
Attachments:
Description Flags
The patch for XSyncValueSubtract none

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>

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.