Explicitely use 'signed char', to avoid problems on platforms with unsigned char type.

This commit is contained in:
Thomas Heller 2006-04-05 19:51:19 +00:00
parent fb8f83b33f
commit 0890de3be0
1 changed files with 2 additions and 2 deletions

View File

@ -499,7 +499,7 @@ b_set(void *ptr, PyObject *value, unsigned size)
long val;
if (get_long(value, &val) < 0)
return NULL;
*(char *)ptr = (char)SET(*(char *)ptr, (char)val, size);
*(signed char *)ptr = (signed char)SET(*(signed char *)ptr, (signed char)val, size);
_RET(value);
}
@ -507,7 +507,7 @@ b_set(void *ptr, PyObject *value, unsigned size)
static PyObject *
b_get(void *ptr, unsigned size)
{
char val = *(char *)ptr;
signed char val = *(signed char *)ptr;
GET_BITFIELD(val, size);
return PyInt_FromLong(val);
}