From c16f19c80e714e37462e4ada9fa6f263d88adcd0 Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Wed, 24 May 2023 21:31:04 -0700 Subject: [PATCH] Flip #if logic for unaligned access Assume only x86 can correctly/efficiently handle unaligned access. --- src/misc/pv/byteBuffer.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/misc/pv/byteBuffer.h b/src/misc/pv/byteBuffer.h index 4a71c8a..321f35d 100644 --- a/src/misc/pv/byteBuffer.h +++ b/src/misc/pv/byteBuffer.h @@ -150,14 +150,17 @@ struct swap<8> { #undef _PVA_swap64 /* PVD serialization doesn't pay attention to alignement, - * which some targets really care about and treat unaligned + * which some targets (ARM and powerpc) really care about and treat unaligned * access as a fault, or with a heavy penalty (~= to a syscall). * * For those targets,, we will have to live with the increase * in execution time and/or object code size of byte-wise copy. + * + * Treat x86 32/64 as an outlier, and assume all other targets + * need, or greatly benefit, from aligned access. */ -#if defined(_ARCH_PPC) || defined(__arm__) || defined(_M_ARM) +#if !(defined(__x86_64__) || defined(_M_AMD64) || defined(__i386__) || defined(_M_IX86)) template union alignu {