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

Valentin V. Bartenev vbart at nginx.com
Sun Feb 4 01:21:13 UTC 2018


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


More information about the nginx-devel mailing list