Commit ebc15bae authored by Yedidya Feldblum's avatar Yedidya Feldblum Committed by Facebook GitHub Bot

avoid the name I in some places

Summary:
There is a collision with `#define I` in glibc's `math/complex.h`.

https://github.com/bminor/glibc/blob/glibc-2.35/math/complex.h#L53

Differential Revision: D34202940

fbshipit-source-id: 15c6f6cd1d01e8f84f228f6ef51b9c2a42f27071
parent 5bed9cc9
...@@ -1831,10 +1831,10 @@ std::vector<Future<Result>> window( ...@@ -1831,10 +1831,10 @@ std::vector<Future<Result>> window(
// reduce // reduce
template <class T> template <class T>
template <class I, class F> template <class In, class F>
Future<I> Future<T>::reduce(I&& initial, F&& func) && { Future<In> Future<T>::reduce(In&& initial, F&& func) && {
return std::move(*this).thenValue( return std::move(*this).thenValue(
[minitial = static_cast<I&&>(initial), [minitial = static_cast<In&&>(initial),
mfunc = static_cast<F&&>(func)](T&& vals) mutable { mfunc = static_cast<F&&>(func)](T&& vals) mutable {
auto ret = std::move(minitial); auto ret = std::move(minitial);
for (auto& val : vals) { for (auto& val : vals) {
......
...@@ -1879,8 +1879,8 @@ class Future : private futures::detail::FutureBase<T> { ...@@ -1879,8 +1879,8 @@ class Future : private futures::detail::FutureBase<T> {
/// - Calling code should act as if `valid() == false`, /// - Calling code should act as if `valid() == false`,
/// i.e., as if `*this` was moved into RESULT. /// i.e., as if `*this` was moved into RESULT.
/// - `RESULT.valid() == true` /// - `RESULT.valid() == true`
template <class I, class F> template <class In, class F>
Future<I> reduce(I&& initial, F&& func) &&; Future<In> reduce(In&& initial, F&& func) &&;
/// Moves-out `*this`, creating/returning a corresponding SemiFuture. /// Moves-out `*this`, creating/returning a corresponding SemiFuture.
/// Result will behave like `*this` except result won't have an Executor. /// Result will behave like `*this` except result won't have an Executor.
......
...@@ -378,23 +378,23 @@ inline uint32_t hsieh_hash32_str(const std::string& str) noexcept { ...@@ -378,23 +378,23 @@ inline uint32_t hsieh_hash32_str(const std::string& str) noexcept {
namespace detail { namespace detail {
template <typename I> template <typename Int>
struct integral_hasher { struct integral_hasher {
using folly_is_avalanching = using folly_is_avalanching =
bool_constant<(sizeof(I) >= 8 || sizeof(size_t) == 4)>; bool_constant<(sizeof(Int) >= 8 || sizeof(size_t) == 4)>;
size_t operator()(I const& i) const noexcept { size_t operator()(Int const& i) const noexcept {
static_assert(sizeof(I) <= 16, "Input type is too wide"); static_assert(sizeof(Int) <= 16, "Input type is too wide");
/* constexpr */ if (sizeof(I) <= 4) { /* constexpr */ if (sizeof(Int) <= 4) {
auto const i32 = static_cast<int32_t>(i); // impl accident: sign-extends auto const i32 = static_cast<int32_t>(i); // impl accident: sign-extends
auto const u32 = static_cast<uint32_t>(i32); auto const u32 = static_cast<uint32_t>(i32);
return static_cast<size_t>(hash::jenkins_rev_mix32(u32)); return static_cast<size_t>(hash::jenkins_rev_mix32(u32));
} else if (sizeof(I) <= 8) { } else if (sizeof(Int) <= 8) {
auto const u64 = static_cast<uint64_t>(i); auto const u64 = static_cast<uint64_t>(i);
return static_cast<size_t>(hash::twang_mix64(u64)); return static_cast<size_t>(hash::twang_mix64(u64));
} else { } else {
auto const u = to_unsigned(i); auto const u = to_unsigned(i);
auto const hi = static_cast<uint64_t>(u >> sizeof(I) * 4); auto const hi = static_cast<uint64_t>(u >> sizeof(Int) * 4);
auto const lo = static_cast<uint64_t>(u); auto const lo = static_cast<uint64_t>(u);
return hash::hash_128_to_64(hi, lo); return hash::hash_128_to_64(hi, lo);
} }
......
...@@ -124,13 +124,13 @@ extern template to_ascii_table<10, to_ascii_alphabet_upper>::data_type_ const ...@@ -124,13 +124,13 @@ extern template to_ascii_table<10, to_ascii_alphabet_upper>::data_type_ const
extern template to_ascii_table<16, to_ascii_alphabet_upper>::data_type_ const extern template to_ascii_table<16, to_ascii_alphabet_upper>::data_type_ const
to_ascii_table<16, to_ascii_alphabet_upper>::data; to_ascii_table<16, to_ascii_alphabet_upper>::data;
template <uint64_t Base, typename I> template <uint64_t Base, typename Int>
struct to_ascii_powers { struct to_ascii_powers {
static constexpr size_t size_(I v) { static constexpr size_t size_(Int v) {
return 1 + (v < Base ? 0 : size_(v / Base)); return 1 + (v < Base ? 0 : size_(v / Base));
} }
static constexpr size_t const size = size_(~I(0)); static constexpr size_t const size = size_(~Int(0));
using data_type_ = c_array<I, size>; using data_type_ = c_array<Int, size>;
static constexpr data_type_ data_() { static constexpr data_type_ data_() {
data_type_ result{}; data_type_ result{};
for (size_t i = 0; i < size; ++i) { for (size_t i = 0; i < size; ++i) {
...@@ -141,12 +141,12 @@ struct to_ascii_powers { ...@@ -141,12 +141,12 @@ struct to_ascii_powers {
// @lint-ignore CLANGTIDY // @lint-ignore CLANGTIDY
static data_type_ const data; static data_type_ const data;
}; };
template <uint64_t Base, typename I> template <uint64_t Base, typename Int>
constexpr size_t const to_ascii_powers<Base, I>::size; constexpr size_t const to_ascii_powers<Base, Int>::size;
template <uint64_t Base, typename I> template <uint64_t Base, typename Int>
alignas(hardware_constructive_interference_size) alignas(hardware_constructive_interference_size)
typename to_ascii_powers<Base, I>::data_type_ const typename to_ascii_powers<Base, Int>::data_type_ const
to_ascii_powers<Base, I>::data = to_ascii_powers<Base, I>::data_(); to_ascii_powers<Base, Int>::data = to_ascii_powers<Base, Int>::data_();
extern template to_ascii_powers<8, uint64_t>::data_type_ const extern template to_ascii_powers<8, uint64_t>::data_type_ const
to_ascii_powers<8, uint64_t>::data; to_ascii_powers<8, uint64_t>::data;
...@@ -328,16 +328,16 @@ FOLLY_ALWAYS_INLINE size_t to_ascii_with_route(char (&out)[N], uint64_t v) { ...@@ -328,16 +328,16 @@ FOLLY_ALWAYS_INLINE size_t to_ascii_with_route(char (&out)[N], uint64_t v) {
// //
// In base 10, u64 requires at most 20 bytes, u32 at most 10, u16 at most 5, // In base 10, u64 requires at most 20 bytes, u32 at most 10, u16 at most 5,
// and u8 at most 3. // and u8 at most 3.
template <uint64_t Base, typename I> template <uint64_t Base, typename Int>
FOLLY_INLINE_VARIABLE constexpr size_t to_ascii_size_max = FOLLY_INLINE_VARIABLE constexpr size_t to_ascii_size_max =
detail::to_ascii_powers<Base, I>::size; detail::to_ascii_powers<Base, Int>::size;
// to_ascii_size_max_decimal // to_ascii_size_max_decimal
// //
// An alias to to_ascii_size_max<10>. // An alias to to_ascii_size_max<10>.
template <typename I> template <typename Int>
FOLLY_INLINE_VARIABLE constexpr size_t to_ascii_size_max_decimal = FOLLY_INLINE_VARIABLE constexpr size_t to_ascii_size_max_decimal =
to_ascii_size_max<10, I>; to_ascii_size_max<10, Int>;
// to_ascii_size // to_ascii_size
// //
......
...@@ -226,22 +226,22 @@ inline bool atomic_fetch_flip_native( ...@@ -226,22 +226,22 @@ inline bool atomic_fetch_flip_native(
#define FOLLY_DETAIL_ATOMIC_BIT_OP_DEFINE(instr) \ #define FOLLY_DETAIL_ATOMIC_BIT_OP_DEFINE(instr) \
struct atomic_fetch_bit_op_native_##instr##_fn { \ struct atomic_fetch_bit_op_native_##instr##_fn { \
template <typename I> \ template <typename Int> \
FOLLY_ERASE bool operator()(I* ptr, I bit) const { \ FOLLY_ERASE bool operator()(Int* ptr, Int bit) const { \
bool out = false; \ bool out = false; \
if (sizeof(I) == 2) { \ if (sizeof(Int) == 2) { \
asm volatile("lock " #instr "w %1, (%2); setc %0" \ asm volatile("lock " #instr "w %1, (%2); setc %0" \
: "=r"(out) \ : "=r"(out) \
: "ri"(bit), "r"(ptr) \ : "ri"(bit), "r"(ptr) \
: "memory", "flags"); \ : "memory", "flags"); \
} \ } \
if (sizeof(I) == 4) { \ if (sizeof(Int) == 4) { \
asm volatile("lock " #instr "l %1, (%2); setc %0" \ asm volatile("lock " #instr "l %1, (%2); setc %0" \
: "=r"(out) \ : "=r"(out) \
: "ri"(bit), "r"(ptr) \ : "ri"(bit), "r"(ptr) \
: "memory", "flags"); \ : "memory", "flags"); \
} \ } \
if (sizeof(I) == 8) { \ if (sizeof(Int) == 8) { \
asm volatile("lock " #instr "q %1, (%2); setc %0" \ asm volatile("lock " #instr "q %1, (%2); setc %0" \
: "=r"(out) \ : "=r"(out) \
: "ri"(bit), "r"(ptr) \ : "ri"(bit), "r"(ptr) \
......
...@@ -107,12 +107,12 @@ TEST_F(AtomicCompareExchangeSuccTest, examples) { ...@@ -107,12 +107,12 @@ TEST_F(AtomicCompareExchangeSuccTest, examples) {
namespace { namespace {
template <typename I> template <typename L>
struct with_seq_cst : private I { struct with_seq_cst : private L {
explicit with_seq_cst(I i) noexcept : I{i} {} explicit with_seq_cst(L i) noexcept : L{i} {}
template <typename... A> template <typename... A>
constexpr decltype(auto) operator()(A&&... a) const noexcept { constexpr decltype(auto) operator()(A&&... a) const noexcept {
return I::operator()(static_cast<A&&>(a)..., std::memory_order_seq_cst); return L::operator()(static_cast<A&&>(a)..., std::memory_order_seq_cst);
} }
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment