[PATCH 2 of 2] Updated __ORDER_LITTLE_ENDIAN__ to match NGX standards and changed to uint32_t data type

Matthew Marangoni matthew.marangoni at gmail.com
Mon Feb 12 20:18:34 UTC 2018


Are there any existing macro's that determine if the platform has alignment
resolution issues?

On Sat, Feb 3, 2018 at 8:21 PM, Valentin V. Bartenev <vbart at nginx.com>
wrote:

> On Saturday, 3 February 2018 19:39:55 MSK Matthew Marangoni wrote:
> > # HG changeset patch
> > # User Matthew Marangoni <matthew.marangoni at gmail.com>
> > # Date 1517675878 28800
> > #      Sat Feb 03 08:37:58 2018 -0800
> > # Node ID 4fe15c57e1d5c7fa4e2daa365f82fd00d0a1f6f4
> > # Parent  e84b174c99ca39155e80dbb7458181e20190b70b
> > Updated __ORDER_LITTLE_ENDIAN__ to match NGX standards and changed to
> uint32_t data type
> >
> > diff -r e84b174c99ca -r 4fe15c57e1d5 src/core/ngx_murmurhash.c
> > --- a/src/core/ngx_murmurhash.c       Mon Jan 22 13:15:25 2018 -0800
> > +++ b/src/core/ngx_murmurhash.c       Sat Feb 03 08:37:58 2018 -0800
> > @@ -16,8 +16,8 @@
> >      h = 0 ^ len;
> >
> >      while (len >= 4) {
> > -#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
> > -        k = *(u_int32_t*)data;
> > +#if (NGX_HAVE_LITTLE_ENDIAN)
> > +        k = *(uint32_t*)data;
> >  #else
> >          k  = data[0];
> >          k |= data[1] << 8;
>
>
> Your patch will break nginx on platforms that have alignment requirements.
>
>   wbr, Valentin V. Bartenev
> _______________________________________________
> nginx-devel mailing list
> nginx-devel at nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx-devel/attachments/20180212/59c62772/attachment.html>


More information about the nginx-devel mailing list