...
> >     ptr = (u64 *)(buff - offset);
> >     shift = offset * 8;
> >
> >     /*
> >      * Head: zero out any excess leading bytes. Shifting back by the same
> >      * amount should be at least as fast as any other way of handling the
> >      * odd/even alignment, and means we can ignore it until the very end.
> >      */
> >     data = *ptr++;
> > #ifdef __LITTLE_ENDIAN
> >     data = (data >> shift) << shift;
> > #else
> >     data = (data << shift) >> shift;
> > #endif

I suspect that
#ifdef __LITTLE_ENDIAN
        data &= ~0ull << shift;
#else
        data &= ~0ull >> shift;
#endif
is likely to be better.

        David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, 
UK
Registration No: 1397386 (Wales)

Reply via email to