[PATCH libXi] 1UL may be 4 bytes, force to 1ULL

Peter Hutterer peter.hutterer at who-t.net
Sun Oct 2 16:30:14 PDT 2011


On Sun, Oct 02, 2011 at 10:52:03AM -0700, Jamey Sharp wrote:
> On 10/2/11, Daniel Stone <daniel at fooishbar.org> wrote:
> > On 2 October 2011 09:19, Jeremy Huddleston <jeremyhu at apple.com> wrote:
> >> Peter, any thoughts on this?
> >
> > I think using * (1 << 16) * (1 << 16) is a better idea than (1ULL << 32).
> 
> And I think ldexp is a much better idea than either. :-) It's more
> clear, and as an added bonus, probably faster. (You can multiply a
> double by a power of two just by adding the exponents. Division by an
> arbitrary constant is stupidly slow by comparison.)
> 
> To me, the interesting part of Jeremy's question was whether helper
> functions are worthwhile for these conversions, 

yes.

> and if so, where they should live.

preferably not in in the protocol. it exposes us to more bugs in the
protocol headers (which in theory should be static). And since they're
built-in updating them in case a bug is found is harder, you'll need to
rebuild anything that uses the headers, simply updating the component isn't
enough (that's from a distro POV).

tbh, that's one case where I'd accept duplicate implementations in the
server and libX*.

Cheers,
  Peter


More information about the xorg-devel mailing list