This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Simplify _MEM_WRAP_NEEDS_RUNTIME_CHECK()
authorDavid Mitchell <davem@iabyn.com>
Thu, 3 Mar 2016 10:59:57 +0000 (10:59 +0000)
committerDavid Mitchell <davem@iabyn.com>
Fri, 4 Mar 2016 21:07:54 +0000 (21:07 +0000)
And at the same time hopefully avoid some false-positive compiler warnings
on HP-UX

handy.h

diff --git a/handy.h b/handy.h
index 2177080..5702681 100644 (file)
--- a/handy.h
+++ b/handy.h
@@ -1942,8 +1942,7 @@ PoisonWith(0xEF) for catching access to freed memory.
  */
 
 #  define _MEM_WRAP_NEEDS_RUNTIME_CHECK(n,t) \
-    (  sizeof(MEM_SIZE) < sizeof(n) \
-    || sizeof(t) > ((MEM_SIZE)1 << 8*(sizeof(MEM_SIZE) - sizeof(n))))
+    (8 * sizeof(n) + sizeof(t) > sizeof(MEM_SIZE))
 
 /* This is written in a slightly odd way to avoid various spurious
  * compiler warnings. We *want* to write the expression as