Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
1e7205a6
Kaydet (Commit)
1e7205a6
authored
Tem 04, 2000
tarafından
Marc-André Lemburg
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Bill Tutt:
Make unicode_compare a true UTF-16 compare function (includes support for surrogates).
üst
4b0200e3
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
6 deletions
+29
-6
unicodeobject.c
Objects/unicodeobject.c
+29
-6
No files found.
Objects/unicodeobject.c
Dosyayı görüntüle @
1e7205a6
...
...
@@ -3045,22 +3045,45 @@ unicode_center(PyUnicodeObject *self, PyObject *args)
return
(
PyObject
*
)
pad
(
self
,
left
,
marg
-
left
,
' '
);
}
/* speedy UTF-16 code point order comparison */
/* gleaned from: */
/* http://www-4.ibm.com/software/developer/library/utf16.html?dwzone=unicode */
static
unsigned
short
utf16Fixup
[
32
]
=
{
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0x2000
,
0xf800
,
0xf800
,
0xf800
,
0xf800
};
static
int
unicode_compare
(
PyUnicodeObject
*
str1
,
PyUnicodeObject
*
str2
)
{
int
len1
,
len2
;
Py_UNICODE
*
s1
=
str1
->
str
;
Py_UNICODE
*
s2
=
str2
->
str
;
len1
=
str1
->
length
;
len2
=
str2
->
length
;
while
(
len1
>
0
&&
len2
>
0
)
{
int
cmp
=
(
*
s1
++
)
-
(
*
s2
++
);
if
(
cmp
)
/* This should make Christian happy! */
return
(
cmp
<
0
)
?
-
1
:
(
cmp
!=
0
);
len1
--
,
len2
--
;
unsigned
short
c1
,
c2
;
/* 16 bits */
int
diff
;
/* 32 bits */
c1
=
*
s1
++
;
c2
=
*
s2
++
;
if
(
c1
>
(
1
<<
11
)
*
26
)
c1
+=
utf16Fixup
[
c1
>>
11
];
if
(
c2
>
(
1
<<
11
)
*
26
)
c2
+=
utf16Fixup
[
c2
>>
11
];
/* now c1 and c2 are in UTF-32-compatible order */
diff
=
(
int
)
c1
-
(
int
)
c2
;
if
(
diff
)
return
(
diff
<
0
)
?
-
1
:
(
diff
!=
0
);
len1
--
;
len2
--
;
}
return
(
len1
<
len2
)
?
-
1
:
(
len1
!=
len2
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment