Bug 23438 - XSyncValueSubtract() does not subtract 2 SyncValues properly
Summary: XSyncValueSubtract() does not subtract 2 SyncValues properly
Status: RESOLVED FIXED
Alias: None
Product: xorg
Classification: Unclassified
Component: Lib/Xext (show other bugs)
Version: 7.4 (2008.09)
Hardware: Other All
: medium normal
Assignee: Xorg Project Team
QA Contact: Xorg Project Team
URL: http://linuxtesting.org/results/repor...
Whiteboard:
Keywords: patch
Depends on:
Blocks:
 
Reported: 2009-08-21 05:02 UTC by Eduard Bagrov
Modified: 2009-08-22 11:07 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


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

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.