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
f5b62a9b
Kaydet (Commit)
f5b62a9b
authored
Ock 14, 2012
tarafından
Gregory P. Smith
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Sade Fark
Consolidate the occurrances of the prime used as the multiplier when hashing.
üst
d66b5051
63e6c322
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
7 additions
and
4 deletions
+7
-4
pyport.h
Include/pyport.h
+4
-1
object.c
Objects/object.c
+1
-1
tupleobject.c
Objects/tupleobject.c
+1
-1
unicodeobject.c
Objects/unicodeobject.c
+1
-1
No files found.
Include/pyport.h
Dosyayı görüntüle @
f5b62a9b
...
...
@@ -131,6 +131,9 @@ Used in: PY_LONG_LONG
#endif
#endif
/* Prime multiplier used in string and various other hashes. */
#define _PyHASH_MULTIPLIER 1000003
/* 0xf4243 */
/* Parameters used for the numeric hash implementation. See notes for
_Py_HashDouble in Objects/object.c. Numeric hashes are based on
reduction modulo the prime 2**_PyHASH_BITS - 1. */
...
...
@@ -143,7 +146,7 @@ Used in: PY_LONG_LONG
#define _PyHASH_MODULUS (((size_t)1 << _PyHASH_BITS) - 1)
#define _PyHASH_INF 314159
#define _PyHASH_NAN 0
#define _PyHASH_IMAG
1000003UL
#define _PyHASH_IMAG
_PyHASH_MULTIPLIER
/* uintptr_t is the C9X name for an unsigned integral type such that a
* legitimate void* can be cast to uintptr_t and then back to void* again
...
...
Objects/object.c
Dosyayı görüntüle @
f5b62a9b
...
...
@@ -761,7 +761,7 @@ _Py_HashBytes(unsigned char *p, Py_ssize_t len)
x
=
(
Py_uhash_t
)
*
p
<<
7
;
for
(
i
=
0
;
i
<
len
;
i
++
)
x
=
(
1000003U
*
x
)
^
(
Py_uhash_t
)
*
p
++
;
x
=
(
_PyHASH_MULTIPLIER
*
x
)
^
(
Py_uhash_t
)
*
p
++
;
x
^=
(
Py_uhash_t
)
len
;
if
(
x
==
-
1
)
x
=
-
2
;
...
...
Objects/tupleobject.c
Dosyayı görüntüle @
f5b62a9b
...
...
@@ -316,7 +316,7 @@ tuplehash(PyTupleObject *v)
register
Py_hash_t
y
;
register
Py_ssize_t
len
=
Py_SIZE
(
v
);
register
PyObject
**
p
;
Py_uhash_t
mult
=
1000003
;
Py_uhash_t
mult
=
_PyHASH_MULTIPLIER
;
x
=
0x345678
;
p
=
v
->
ob_item
;
while
(
--
len
>=
0
)
{
...
...
Objects/unicodeobject.c
Dosyayı görüntüle @
f5b62a9b
...
...
@@ -11210,7 +11210,7 @@ unicode_hash(PyObject *self)
#define HASH(P) \
x = (Py_uhash_t)*P << 7; \
while (--len >= 0) \
x = (
1000003
*x) ^ (Py_uhash_t)*P++;
x = (
_PyHASH_MULTIPLIER
*x) ^ (Py_uhash_t)*P++;
switch (PyUnicode_KIND(self)) {
case PyUnicode_1BYTE_KIND: {
...
...
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