[Python-checkins] cpython: blake2: silence two more warnings on platforms with size_t < uint64_t. Don't

christian.heimes python-checkins at python.org
Wed Sep 7 05:39:39 EDT 2016


https://hg.python.org/cpython/rev/bb3927eb5f4c
changeset:   103216:bb3927eb5f4c
user:        Christian Heimes <christian at python.org>
date:        Wed Sep 07 11:39:21 2016 +0200
summary:
  blake2: silence two more warnings on platforms with size_t < uint64_t. Don't use SSE2 when cross-compiling

files:
  Modules/_blake2/impl/blake2b-ref.c |  4 ++--
  Modules/_blake2/impl/blake2s-ref.c |  4 ++--
  setup.py                           |  2 +-
  3 files changed, 5 insertions(+), 5 deletions(-)


diff --git a/Modules/_blake2/impl/blake2b-ref.c b/Modules/_blake2/impl/blake2b-ref.c
--- a/Modules/_blake2/impl/blake2b-ref.c
+++ b/Modules/_blake2/impl/blake2b-ref.c
@@ -307,8 +307,8 @@
     }
     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
--- a/Modules/_blake2/impl/blake2s-ref.c
+++ b/Modules/_blake2/impl/blake2s-ref.c
@@ -298,8 +298,8 @@
     }
     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
--- a/setup.py
+++ b/setup.py
@@ -894,7 +894,7 @@
         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'))
 

-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list