Details

[Home]

Issue of the Implementation # D0131

Brief

The function XSyncValueSubtract does not subtract two values correctly

Detailed Description

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

Problem location(s) in the standard

Linux Standard Base Desktop Specification 3.2. Chapter 6. Libraries. 6.11.5. X Synchronization Extension that refers http://refspecs.linux-foundation.org/X11/synclib.pdf

Example

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

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

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

Possible solutions

In the _XSyncValueSubtract MACRO if (t>(presult)->lo) (presult)->hi--;\ must be replaced with if (t<(presult)->lo) (presult)->hi--;\ Sign '>' with '<'

Component

X11 7.3 or early

Accepted

bugzilla.freedesktop.org 23438

Status

fixed in xextproto git

[Home]