Branch: Tag:

1998-10-15

1998-10-15 18:54:31 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Fixed sign-expansion bug on little-endian systems.

Rev: src/builtin_functions.c:1.134

4:   ||| See the files COPYING and DISCLAIMER for more information.   \*/   #include "global.h" - RCSID("$Id: builtin_functions.c,v 1.133 1998/10/15 18:47:51 grubba Exp $"); + RCSID("$Id: builtin_functions.c,v 1.134 1998/10/15 18:54:31 grubba Exp $");   #include "interpret.h"   #include "svalue.h"   #include "pike_macros.h"
636:    p_wchar1 *str1 = STR1(in);    for(i = in->len; i--;) {    unsigned INT32 c = str1[i]; -  out->str[i * 2] = c >> 8; +     out->str[i * 2 + 1] = c & 0xff; -  +  out->str[i * 2] = c >> 8;    }    }   #endif
736:    p_wchar1 *str1 = STR1(out);       for (i = len; i--;) { -  str1[i] = (in->str[i*2]<<8) + in->str[i*2 + 1]; +  str1[i] = (((unsigned char *)in->str)[i*2]<<8) + +  ((unsigned char *)in->str)[i*2 + 1];    }    }   #endif /* BYTEORDER == 4321 */