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
b7a80d54
Unverified
Kaydet (Commit)
b7a80d54
authored
Ock 24, 2018
tarafından
Yury Selivanov
Kaydeden (comit)
GitHub
Ock 24, 2018
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
bpo-32436: Don't use native popcount() (also fixes bpo-32641) (#5292)
üst
6b273f7f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
15 deletions
+13
-15
context.c
Python/context.c
+1
-1
hamt.c
Python/hamt.c
+12
-14
No files found.
Python/context.c
Dosyayı görüntüle @
b7a80d54
...
@@ -1171,7 +1171,7 @@ get_token_missing(void)
...
@@ -1171,7 +1171,7 @@ get_token_missing(void)
int
int
PyContext_ClearFreeList
(
void
)
PyContext_ClearFreeList
(
void
)
{
{
in
t
size
=
ctx_freelist_len
;
Py_ssize_
t
size
=
ctx_freelist_len
;
while
(
ctx_freelist_len
)
{
while
(
ctx_freelist_len
)
{
PyContext
*
ctx
=
ctx_freelist
;
PyContext
*
ctx
=
ctx_freelist
;
ctx_freelist
=
(
PyContext
*
)
ctx
->
ctx_weakreflist
;
ctx_freelist
=
(
PyContext
*
)
ctx
->
ctx_weakreflist
;
...
...
Python/hamt.c
Dosyayı görüntüle @
b7a80d54
...
@@ -4,11 +4,6 @@
...
@@ -4,11 +4,6 @@
#include "internal/pystate.h"
#include "internal/pystate.h"
#include "internal/hamt.h"
#include "internal/hamt.h"
/* popcnt support in Visual Studio */
#ifdef _MSC_VER
#include <intrin.h>
#endif
/*
/*
This file provides an implemention of an immutable mapping using the
This file provides an implemention of an immutable mapping using the
Hash Array Mapped Trie (or HAMT) datastructure.
Hash Array Mapped Trie (or HAMT) datastructure.
...
@@ -440,18 +435,21 @@ hamt_bitpos(int32_t hash, uint32_t shift)
...
@@ -440,18 +435,21 @@ hamt_bitpos(int32_t hash, uint32_t shift)
static
inline
uint32_t
static
inline
uint32_t
hamt_bitcount
(
uint32_t
i
)
hamt_bitcount
(
uint32_t
i
)
{
{
#if defined(__GNUC__) && (__GNUC__ > 4)
/* We could use native popcount instruction but that would
return
(
uint32_t
)
__builtin_popcountl
(
i
);
require to either add configure flags to enable SSE4.2
#elif defined(__clang__) && (__clang_major__ > 3)
support or to detect it dynamically. Otherwise, we have
return
(
uint32_t
)
__builtin_popcountl
(
i
);
a risk of CPython not working properly on older hardware.
#elif defined(_MSC_VER)
return
(
uint32_t
)
__popcnt
(
i
);
In practice, there's no observable difference in
#else
performance between using a popcount instruction or the
/* https://graphics.stanford.edu/~seander/bithacks.html */
following fallback code.
The algorithm is copied from:
https://graphics.stanford.edu/~seander/bithacks.html
*/
i
=
i
-
((
i
>>
1
)
&
0x55555555
);
i
=
i
-
((
i
>>
1
)
&
0x55555555
);
i
=
(
i
&
0x33333333
)
+
((
i
>>
2
)
&
0x33333333
);
i
=
(
i
&
0x33333333
)
+
((
i
>>
2
)
&
0x33333333
);
return
((
i
+
(
i
>>
4
)
&
0xF0F0F0F
)
*
0x1010101
)
>>
24
;
return
((
i
+
(
i
>>
4
)
&
0xF0F0F0F
)
*
0x1010101
)
>>
24
;
#endif
}
}
static
inline
uint32_t
static
inline
uint32_t
...
...
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