summaryrefslogtreecommitdiff
path: root/apt-pkg
diff options
context:
space:
mode:
authorJulian Andres Klode <julian.klode@canonical.com>2019-02-03 16:39:37 +0100
committerJulian Andres Klode <julian.klode@canonical.com>2019-02-04 15:21:32 +0100
commit2cc1b3a3ee595c8be761fee309167b8a56393d3e (patch)
treeb6d6639a2a8334db771d78025b3af7f9838dce4b /apt-pkg
parentcde5ee8fe527d3d672775909d27110d11c393774 (diff)
Detect function multiversioning and sse4.2/crc32, enables i386
This fixes the build on kfreebsd-amd64, and due to the detection of sse4.2, should also enable the sse4.2 on i386.
Diffstat (limited to 'apt-pkg')
-rw-r--r--apt-pkg/pkgcache.cc8
1 files changed, 6 insertions, 2 deletions
diff --git a/apt-pkg/pkgcache.cc b/apt-pkg/pkgcache.cc
index 041f0b957..80dd1d1fa 100644
--- a/apt-pkg/pkgcache.cc
+++ b/apt-pkg/pkgcache.cc
@@ -231,15 +231,16 @@ map_id_t pkgCache::sHash(const char *Str) const
return Hash % HeaderP->GetHashTableSize();
}
-#if defined(__GNUC__) && defined(__x86_64__) && defined(__ELF__)
+#if defined(HAVE_FMV_SSE42_AND_CRC32)
-#if defined(__x86_64__)
+#ifdef HAVE_FMV_SSE42_AND_CRC32
__attribute__((target("sse4.2"))) static uint32_t hash32(uint32_t crc32, const unsigned char *input, size_t size)
{
if (input == nullptr)
return 0;
crc32 ^= 0xffffffffU;
+#ifdef HAVE_FMV_SSE42_AND_CRC32DI
while (size >= 8) {
crc32 = __builtin_ia32_crc32di(crc32, *(uint64_t *)input);
input += 8;
@@ -247,6 +248,9 @@ __attribute__((target("sse4.2"))) static uint32_t hash32(uint32_t crc32, const u
}
if (size >= 4) {
+#else
+ while (size >= 4) {
+#endif
crc32 = __builtin_ia32_crc32si(crc32, *(uint32_t *)input);
input += 4;
size -= 4;