From: Christian Heimes Date: Wed, 7 Sep 2016 09:39:21 +0000 (+0200) Subject: blake2: silence two more warnings on platforms with size_t < uint64_t. Don't use... X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=dfb9ef13575bcc457544b408fc4e5eca3c5ed9b1;p=python blake2: silence two more warnings on platforms with size_t < uint64_t. Don't use SSE2 when cross-compiling --- diff --git a/Modules/_blake2/impl/blake2b-ref.c b/Modules/_blake2/impl/blake2b-ref.c index 7c1301bef6..ec775b4d4b 100644 --- a/Modules/_blake2/impl/blake2b-ref.c +++ b/Modules/_blake2/impl/blake2b-ref.c @@ -307,8 +307,8 @@ int blake2b_update( blake2b_state *S, const uint8_t *in, uint64_t inlen ) } else /* inlen <= fill */ { - memcpy( S->buf + left, in, inlen ); - S->buflen += inlen; /* Be lazy, do not compress */ + memcpy( S->buf + left, in, (size_t)inlen ); + S->buflen += (size_t)inlen; /* Be lazy, do not compress */ in += inlen; inlen -= inlen; } diff --git a/Modules/_blake2/impl/blake2s-ref.c b/Modules/_blake2/impl/blake2s-ref.c index b90e8efc4e..b08e72b737 100644 --- a/Modules/_blake2/impl/blake2s-ref.c +++ b/Modules/_blake2/impl/blake2s-ref.c @@ -298,8 +298,8 @@ int blake2s_update( blake2s_state *S, const uint8_t *in, uint64_t inlen ) } else /* inlen <= fill */ { - memcpy( S->buf + left, in, inlen ); - S->buflen += inlen; /* Be lazy, do not compress */ + memcpy( S->buf + left, in, (size_t)inlen ); + S->buflen += (size_t)inlen; /* Be lazy, do not compress */ in += inlen; inlen -= inlen; } diff --git a/setup.py b/setup.py index ed1acfd847..5450b7ed75 100644 --- a/setup.py +++ b/setup.py @@ -894,7 +894,7 @@ class PyBuildExt(build_ext): blake2_deps.append('hashlib.h') blake2_macros = [] - if os.uname().machine == "x86_64": + if not cross_compiling and os.uname().machine == "x86_64": # Every x86_64 machine has at least SSE2. blake2_macros.append(('BLAKE2_USE_SSE', '1'))