mirror of https://github.com/python/cpython.git
more unicode tweaks: fix unicodectype for sizeof(Py_UNICODE) >
sizeof(int)
This commit is contained in:
parent
e9218a1a8e
commit
ee13dba1aa
|
@ -32,16 +32,17 @@ typedef struct {
|
||||||
#include "unicodetype_db.h"
|
#include "unicodetype_db.h"
|
||||||
|
|
||||||
static const _PyUnicode_TypeRecord *
|
static const _PyUnicode_TypeRecord *
|
||||||
gettyperecord(int code)
|
gettyperecord(Py_UNICODE code)
|
||||||
{
|
{
|
||||||
int index;
|
int index;
|
||||||
|
|
||||||
if (code < 0 || code >= 65536)
|
if (code >= 65536)
|
||||||
index = 0;
|
index = 0;
|
||||||
else {
|
else {
|
||||||
index = index1[(code>>SHIFT)];
|
index = index1[(code>>SHIFT)];
|
||||||
index = index2[(index<<SHIFT)+(code&((1<<SHIFT)-1))];
|
index = index2[(index<<SHIFT)+(code&((1<<SHIFT)-1))];
|
||||||
}
|
}
|
||||||
|
|
||||||
return &_PyUnicode_TypeRecords[index];
|
return &_PyUnicode_TypeRecords[index];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue