aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/utils/os_utils.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/utils/os_utils.cpp')
-rw-r--r--src/lib/utils/os_utils.cpp18
1 files changed, 10 insertions, 8 deletions
diff --git a/src/lib/utils/os_utils.cpp b/src/lib/utils/os_utils.cpp
index 7bd9b842d..e887d6e76 100644
--- a/src/lib/utils/os_utils.cpp
+++ b/src/lib/utils/os_utils.cpp
@@ -51,12 +51,13 @@ uint64_t OS::get_processor_timestamp()
#elif defined(BOTAN_USE_GCC_INLINE_ASM)
#if defined(BOTAN_TARGET_CPU_IS_X86_FAMILY)
- if(CPUID::has_rdtsc()) // not available on all x86 CPUs
- {
- uint32_t rtc_low = 0, rtc_high = 0;
- asm volatile("rdtsc" : "=d" (rtc_high), "=a" (rtc_low));
- return (static_cast<uint64_t>(rtc_high) << 32) | rtc_low;
- }
+
+ if(CPUID::has_rdtsc() == false)
+ return 0;
+
+ uint32_t rtc_low = 0, rtc_high = 0;
+ asm volatile("rdtsc" : "=d" (rtc_high), "=a" (rtc_low));
+ return (static_cast<uint64_t>(rtc_high) << 32) | rtc_low;
#elif defined(BOTAN_TARGET_ARCH_IS_PPC64)
uint32_t rtc_low = 0, rtc_high = 0;
@@ -99,11 +100,12 @@ uint64_t OS::get_processor_timestamp()
#else
//#warning "OS::get_processor_timestamp not implemented"
+ return 0;
#endif
-#endif
-
+#else
return 0;
+#endif
}
uint64_t OS::get_high_resolution_clock()