Selaa lähdekoodia

make use of RDTSC optional as it may not be available

One example is when using seccomp with PR_SET_TSC set to PR_TSC_SIGSEGV.
Maik Riechert 6 vuotta sitten
vanhempi
commit
15cf5378b3
1 muutettua tiedostoa jossa 1 lisäystä ja 1 poistoa
  1. 1 1
      src/google/protobuf/map.h

+ 1 - 1
src/google/protobuf/map.h

@@ -937,7 +937,7 @@ class Map {
     // Return a randomish value.
     size_type Seed() const {
       size_type s = static_cast<size_type>(reinterpret_cast<uintptr_t>(this));
-#if defined(__x86_64__) && defined(__GNUC__)
+#if defined(__x86_64__) && defined(__GNUC__) && !defined(GOOGLE_PROTOBUF_NO_RDTSC)
       uint32 hi, lo;
       asm("rdtsc" : "=a"(lo), "=d"(hi));
       s += ((static_cast<uint64>(hi) << 32) | lo);