Author: Armin Rigo <[email protected]>
Branch: py3.6
Changeset: r97886:1c74a232abde
Date: 2019-10-29 18:21 +0100
http://bitbucket.org/pypy/pypy/changeset/1c74a232abde/
Log: Turn these flags, containing each 1 to 3 bits, from "unsigned int"
to "unsigned char"
diff --git a/pypy/module/cpyext/parse/cpyext_unicodeobject.h
b/pypy/module/cpyext/parse/cpyext_unicodeobject.h
--- a/pypy/module/cpyext/parse/cpyext_unicodeobject.h
+++ b/pypy/module/cpyext/parse/cpyext_unicodeobject.h
@@ -26,7 +26,7 @@
If interned != SSTATE_NOT_INTERNED, the two references from the
dictionary to this object are *not* counted in ob_refcnt.
*/
- unsigned int interned;
+ unsigned char interned;
/* Character size:
- PyUnicode_WCHAR_KIND (0):
@@ -54,21 +54,21 @@
* all characters are in the range U+0000-U+10FFFF
* at least one character is in the range U+10000-U+10FFFF
*/
- unsigned int kind;
+ unsigned char kind;
/* Compact is with respect to the allocation scheme. Compact unicode
objects only require one memory block while non-compact objects use
one block for the PyUnicodeObject struct and another for its data
buffer. */
- unsigned int compact;
+ unsigned char compact;
/* The string only contains characters in the range U+0000-U+007F
(ASCII)
and the kind is PyUnicode_1BYTE_KIND. If ascii is set and compact is
set, use the PyASCIIObject structure. */
- unsigned int ascii;
+ unsigned char ascii;
/* The ready flag indicates whether the object layout is initialized
completely. This means that this is either a compact object, or
the data pointer is filled out. The bit is redundant, and helps
to minimize the test in PyUnicode_IS_READY(). */
- unsigned int ready;
+ unsigned char ready;
/* Padding to ensure that PyUnicode_DATA() is always aligned to
4 bytes (see issue #19537 on m68k). */
/* not on PyPy */
diff --git a/pypy/module/cpyext/unicodeobject.py
b/pypy/module/cpyext/unicodeobject.py
--- a/pypy/module/cpyext/unicodeobject.py
+++ b/pypy/module/cpyext/unicodeobject.py
@@ -124,19 +124,19 @@
return rffi.getintfield(get_state(py_obj), 'c_kind')
def set_kind(py_obj, value):
- get_state(py_obj).c_kind = cts.cast('unsigned int', value)
+ get_state(py_obj).c_kind = cts.cast('unsigned char', value)
def get_ascii(py_obj):
return rffi.getintfield(get_state(py_obj), 'c_ascii')
def set_ascii(py_obj, value):
- get_state(py_obj).c_ascii = cts.cast('unsigned int', value)
+ get_state(py_obj).c_ascii = cts.cast('unsigned char', value)
def get_ready(py_obj):
return rffi.getintfield(get_state(py_obj), 'c_ready')
def set_ready(py_obj, value):
- get_state(py_obj).c_ready = cts.cast('unsigned int', value)
+ get_state(py_obj).c_ready = cts.cast('unsigned char', value)
def get_wbuffer(py_obj):
py_obj = cts.cast('PyASCIIObject*', py_obj)
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit