/*
- * Copyright 2016 Facebook, Inc.
+ * Copyright 2015-present Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#include <glog/logging.h>
+#include <folly/Portability.h>
#include <folly/experimental/Instructions.h>
namespace folly {
namespace detail {
extern const uint8_t kSelectInByte[2048];
-}
+} // namespace detail
/**
* Returns the position of the k-th 1 in the 64-bit word x.
}
template <>
-FOLLY_TARGET_ATTRIBUTE("bmi,bmi2")
-inline uint64_t select64<compression::instructions::Haswell>(uint64_t x,
- uint64_t k) {
-#if defined(__GNUC__) && !defined(__clang__) && !__GNUC_PREREQ(4, 9)
- // GCC 4.8 doesn't support the intrinsics.
+FOLLY_ALWAYS_INLINE uint64_t
+select64<compression::instructions::Haswell>(uint64_t x, uint64_t k) {
+#if defined(__GNUC__) || defined(__clang__)
+ // GCC and Clang won't inline the intrinsics.
uint64_t result = uint64_t(1) << k;
asm("pdep %1, %0, %0\n\t"