From b0089a92a30ae851e8bad7ca8da8b33dba4a5a95 Mon Sep 17 00:00:00 2001 From: DJ Delorie Date: Thu, 10 May 2001 13:39:19 -0400 Subject: c-common.c (combine_strings): Widen strings in a host-endian-independent way. * c-common.c (combine_strings): Widen strings in a host-endian-independent way. From-SVN: r41941 --- gcc/c-common.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'gcc/c-common.c') diff --git a/gcc/c-common.c b/gcc/c-common.c index 751d67d..a1dc31c 100644 --- a/gcc/c-common.c +++ b/gcc/c-common.c @@ -583,15 +583,22 @@ combine_strings (strings) } else { - int i; + int i, j; for (i = 0; i < len; i++) { - if (WCHAR_TYPE_SIZE == HOST_BITS_PER_SHORT) - ((short *) q)[i] = TREE_STRING_POINTER (t)[i]; + if (BYTES_BIG_ENDIAN) + { + for (j=0; j<(WCHAR_TYPE_SIZE / BITS_PER_UNIT)-1; j++) + *q++ = 0; + *q++ = TREE_STRING_POINTER (t)[i]; + } else - ((int *) q)[i] = TREE_STRING_POINTER (t)[i]; + { + *q++ = TREE_STRING_POINTER (t)[i]; + for (j=0; j<(WCHAR_TYPE_SIZE / BITS_PER_UNIT)-1; j++) + *q++ = 0; + } } - q += len * wchar_bytes; } } if (wide_flag) -- cgit v1.1