Il 26/03/2013 10:58, Peter Lieven ha scritto:
> Signed-off-by: Peter Lieven <[email protected]>
> ---
> include/qemu-common.h | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/include/qemu-common.h b/include/qemu-common.h
> index d7ad3a7..9022646 100644
> --- a/include/qemu-common.h
> +++ b/include/qemu-common.h
> @@ -453,6 +453,7 @@ void hexdump(const char *buf, FILE *fp, const char
> *prefix, size_t size);
> #include <altivec.h>
> #define VECTYPE vector unsigned char
> #define SPLAT(p) vec_splat(vec_ld(0, p), 0)
> +#define ZERO_SPLAT vec_splat(vec_ld(0, 0), 0)
> #define ALL_EQ(v1, v2) vec_all_eq(v1, v2)
> /* altivec.h may redefine the bool macro as vector type.
> * Reset it to POSIX semantics. */
> @@ -462,10 +463,12 @@ void hexdump(const char *buf, FILE *fp, const char
> *prefix, size_t size);
> #include <emmintrin.h>
> #define VECTYPE __m128i
> #define SPLAT(p) _mm_set1_epi8(*(p))
> +#define ZERO_SPLAT _mm_setzero_si128()
> #define ALL_EQ(v1, v2) (_mm_movemask_epi8(_mm_cmpeq_epi8(v1, v2)) == 0xFFFF)
> #else
> #define VECTYPE unsigned long
> #define SPLAT(p) (*(p) * (~0UL / 255))
> +#define ZERO_SPLAT 0x0UL
> #define ALL_EQ(v1, v2) ((v1) == (v2))
> #endif
C trivia of the day: this can be written simply as
(VECTYPE) {0}
Yes, it works even with unsigned long. :) It is a C99 compound literal.
Paolo