|
|
Message-ID: <20150727191831.1UQKD.29194.imail@eastrmwml302>
Date: Mon, 27 Jul 2015 19:18:31 -0400
From: <jfoug@....net>
To: john-dev@...ts.openwall.com
Subject: Re: Ambiguous pointer increments
---- jfoug@....net wrote:
>
> ---- magnum <john.magnum@...hmail.com> wrote:
> > The beignet OpenCL driver complained about oldoffice kernel, "multiple
> > unsequenced modifications to 'p'" for things like the below:
> >
> > - for (i = 0; i < 32; i += 2)
> > - W[i >> 1] = (uint)*p++ | (*p++ << 16U);
> >
> > I already changed it but I'm curious - no other driver complained.
> >
> > + for (i = 0; i < 32; i += 2) {
> > + W[i >> 1] = (uint)*p++;
> > + W[i >> 1] |= (*p++ << 16U);
> > + }
This might be a more optimal way write this:
for (i = 0; i < 32; i+=2,p+=2) {
W[i>>1] = (uint)*p|(((uint)p[1])<<16U);
or even
for (i = 0; i < 32; i+=2) {
W[i>>1] = (uint)p[i]|(((uint)p[i+1])<<16U);
but the second one is dereferencing a variable for offset, to it may not be faster.
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.