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
527eee2b
Kaydet (Commit)
527eee2b
authored
Tem 24, 2008
tarafından
Raymond Hettinger
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Finish conversion from int to Py_ssize_t.
üst
40202218
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
23 deletions
+23
-23
_bisectmodule.c
Modules/_bisectmodule.c
+23
-23
No files found.
Modules/_bisectmodule.c
Dosyayı görüntüle @
527eee2b
...
...
@@ -5,7 +5,7 @@ Converted to C by Dmitry Vasiliev (dima at hlabs.spb.ru).
#include "Python.h"
static
in
t
static
Py_ssize_
t
internal_bisect_right
(
PyObject
*
list
,
PyObject
*
item
,
Py_ssize_t
lo
,
Py_ssize_t
hi
)
{
PyObject
*
litem
;
...
...
@@ -41,18 +41,18 @@ static PyObject *
bisect_right
(
PyObject
*
self
,
PyObject
*
args
,
PyObject
*
kw
)
{
PyObject
*
list
,
*
item
;
in
t
lo
=
0
;
in
t
hi
=
-
1
;
in
t
index
;
Py_ssize_
t
lo
=
0
;
Py_ssize_
t
hi
=
-
1
;
Py_ssize_
t
index
;
static
char
*
keywords
[]
=
{
"a"
,
"x"
,
"lo"
,
"hi"
,
NULL
};
if
(
!
PyArg_ParseTupleAndKeywords
(
args
,
kw
,
"OO|
ii
:bisect_right"
,
if
(
!
PyArg_ParseTupleAndKeywords
(
args
,
kw
,
"OO|
nn
:bisect_right"
,
keywords
,
&
list
,
&
item
,
&
lo
,
&
hi
))
return
NULL
;
index
=
internal_bisect_right
(
list
,
item
,
lo
,
hi
);
if
(
index
<
0
)
return
NULL
;
return
PyInt_From
Long
(
index
);
return
PyInt_From
Ssize_t
(
index
);
}
PyDoc_STRVAR
(
bisect_right_doc
,
...
...
@@ -71,12 +71,12 @@ static PyObject *
insort_right
(
PyObject
*
self
,
PyObject
*
args
,
PyObject
*
kw
)
{
PyObject
*
list
,
*
item
,
*
result
;
in
t
lo
=
0
;
in
t
hi
=
-
1
;
in
t
index
;
Py_ssize_
t
lo
=
0
;
Py_ssize_
t
hi
=
-
1
;
Py_ssize_
t
index
;
static
char
*
keywords
[]
=
{
"a"
,
"x"
,
"lo"
,
"hi"
,
NULL
};
if
(
!
PyArg_ParseTupleAndKeywords
(
args
,
kw
,
"OO|
ii
:insort_right"
,
if
(
!
PyArg_ParseTupleAndKeywords
(
args
,
kw
,
"OO|
nn
:insort_right"
,
keywords
,
&
list
,
&
item
,
&
lo
,
&
hi
))
return
NULL
;
index
=
internal_bisect_right
(
list
,
item
,
lo
,
hi
);
...
...
@@ -86,7 +86,7 @@ insort_right(PyObject *self, PyObject *args, PyObject *kw)
if
(
PyList_Insert
(
list
,
index
,
item
)
<
0
)
return
NULL
;
}
else
{
result
=
PyObject_CallMethod
(
list
,
"insert"
,
"
i
O"
,
result
=
PyObject_CallMethod
(
list
,
"insert"
,
"
n
O"
,
index
,
item
);
if
(
result
==
NULL
)
return
NULL
;
...
...
@@ -106,11 +106,11 @@ If x is already in a, insert it to the right of the rightmost x.\n\
Optional args lo (default 0) and hi (default len(a)) bound the
\n
\
slice of a to be searched.
\n
"
);
static
in
t
internal_bisect_left
(
PyObject
*
list
,
PyObject
*
item
,
int
lo
,
in
t
hi
)
static
Py_ssize_
t
internal_bisect_left
(
PyObject
*
list
,
PyObject
*
item
,
Py_ssize_t
lo
,
Py_ssize_
t
hi
)
{
PyObject
*
litem
;
in
t
mid
,
res
;
Py_ssize_
t
mid
,
res
;
if
(
lo
<
0
)
{
PyErr_SetString
(
PyExc_ValueError
,
"lo must be non-negative"
);
...
...
@@ -142,18 +142,18 @@ static PyObject *
bisect_left
(
PyObject
*
self
,
PyObject
*
args
,
PyObject
*
kw
)
{
PyObject
*
list
,
*
item
;
in
t
lo
=
0
;
in
t
hi
=
-
1
;
in
t
index
;
Py_ssize_
t
lo
=
0
;
Py_ssize_
t
hi
=
-
1
;
Py_ssize_
t
index
;
static
char
*
keywords
[]
=
{
"a"
,
"x"
,
"lo"
,
"hi"
,
NULL
};
if
(
!
PyArg_ParseTupleAndKeywords
(
args
,
kw
,
"OO|
ii
:bisect_left"
,
if
(
!
PyArg_ParseTupleAndKeywords
(
args
,
kw
,
"OO|
nn
:bisect_left"
,
keywords
,
&
list
,
&
item
,
&
lo
,
&
hi
))
return
NULL
;
index
=
internal_bisect_left
(
list
,
item
,
lo
,
hi
);
if
(
index
<
0
)
return
NULL
;
return
PyInt_From
Long
(
index
);
return
PyInt_From
Ssize_t
(
index
);
}
PyDoc_STRVAR
(
bisect_left_doc
,
...
...
@@ -172,12 +172,12 @@ static PyObject *
insort_left
(
PyObject
*
self
,
PyObject
*
args
,
PyObject
*
kw
)
{
PyObject
*
list
,
*
item
,
*
result
;
in
t
lo
=
0
;
in
t
hi
=
-
1
;
in
t
index
;
Py_ssize_
t
lo
=
0
;
Py_ssize_
t
hi
=
-
1
;
Py_ssize_
t
index
;
static
char
*
keywords
[]
=
{
"a"
,
"x"
,
"lo"
,
"hi"
,
NULL
};
if
(
!
PyArg_ParseTupleAndKeywords
(
args
,
kw
,
"OO|
ii
:insort_left"
,
if
(
!
PyArg_ParseTupleAndKeywords
(
args
,
kw
,
"OO|
nn
:insort_left"
,
keywords
,
&
list
,
&
item
,
&
lo
,
&
hi
))
return
NULL
;
index
=
internal_bisect_left
(
list
,
item
,
lo
,
hi
);
...
...
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