Skip to content

Commit 3e72bda

Browse files
goldvitalycopybara-github
authored andcommitted
Remove unused utility functions/constants.
PiperOrigin-RevId: 781407993 Change-Id: I645bd61588de26aa975766f837c46a202925fb8f
1 parent fb23406 commit 3e72bda

File tree

4 files changed

+0
-66
lines changed

4 files changed

+0
-66
lines changed

absl/container/internal/hashtable_control_bytes.h

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -333,13 +333,6 @@ struct GroupSse2Impl {
333333
_mm_movemask_epi8(_mm_cmpgt_epi8_fixed(ctrl, special))));
334334
}
335335

336-
// Returns the number of trailing empty or deleted elements in the group.
337-
uint32_t CountLeadingEmptyOrDeleted() const {
338-
auto special = _mm_set1_epi8(static_cast<char>(ctrl_t::kSentinel));
339-
return TrailingZeros(static_cast<uint32_t>(
340-
_mm_movemask_epi8(_mm_cmpgt_epi8_fixed(special, ctrl)) + 1));
341-
}
342-
343336
void ConvertSpecialToEmptyAndFullToDeleted(ctrl_t* dst) const {
344337
auto msbs = _mm_set1_epi8(static_cast<char>(-128));
345338
auto x126 = _mm_set1_epi8(126);
@@ -424,19 +417,6 @@ struct GroupAArch64Impl {
424417
return NonIterableBitMaskType(mask);
425418
}
426419

427-
uint32_t CountLeadingEmptyOrDeleted() const {
428-
uint64_t mask =
429-
vget_lane_u64(vreinterpret_u64_u8(vcle_s8(
430-
vdup_n_s8(static_cast<int8_t>(ctrl_t::kSentinel)),
431-
vreinterpret_s8_u8(ctrl))),
432-
0);
433-
// Similar to MaskEmptyorDeleted() but we invert the logic to invert the
434-
// produced bitfield. We then count number of trailing zeros.
435-
// Clang and GCC optimize countr_zero to rbit+clz without any check for 0,
436-
// so we should be fine.
437-
return static_cast<uint32_t>(countr_zero(mask)) >> 3;
438-
}
439-
440420
void ConvertSpecialToEmptyAndFullToDeleted(ctrl_t* dst) const {
441421
uint64_t mask = vget_lane_u64(vreinterpret_u64_u8(ctrl), 0);
442422
constexpr uint64_t slsbs = 0x0202020202020202ULL;
@@ -503,14 +483,6 @@ struct GroupPortableImpl {
503483
return NonIterableBitMaskType((~ctrl | (ctrl << 7)) & kMsbs8Bytes);
504484
}
505485

506-
uint32_t CountLeadingEmptyOrDeleted() const {
507-
// ctrl | ~(ctrl >> 7) will have the lowest bit set to zero for kEmpty and
508-
// kDeleted. We lower all other bits and count number of trailing zeros.
509-
constexpr uint64_t bits = 0x0101010101010101ULL;
510-
return static_cast<uint32_t>(countr_zero((ctrl | ~(ctrl >> 7)) & bits) >>
511-
3);
512-
}
513-
514486
void ConvertSpecialToEmptyAndFullToDeleted(ctrl_t* dst) const {
515487
constexpr uint64_t lsbs = 0x0101010101010101ULL;
516488
auto x = ctrl & kMsbs8Bytes;

absl/container/internal/hashtable_control_bytes_test.cc

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -259,32 +259,6 @@ TYPED_TEST(GroupTest, MaskFullOrSentinel) {
259259
}
260260
}
261261

262-
TYPED_TEST(GroupTest, CountLeadingEmptyOrDeleted) {
263-
using GroupType = TypeParam;
264-
const std::vector<ctrl_t> empty_examples = {ctrl_t::kEmpty, ctrl_t::kDeleted};
265-
const std::vector<ctrl_t> full_examples = {
266-
CtrlT(0), CtrlT(1), CtrlT(2), CtrlT(3),
267-
CtrlT(5), CtrlT(9), CtrlT(127), ctrl_t::kSentinel};
268-
269-
for (ctrl_t empty : empty_examples) {
270-
std::vector<ctrl_t> e(GroupType::kWidth, empty);
271-
EXPECT_EQ(GroupType::kWidth,
272-
GroupType{e.data()}.CountLeadingEmptyOrDeleted());
273-
for (ctrl_t full : full_examples) {
274-
for (size_t i = 0; i != GroupType::kWidth; ++i) {
275-
std::vector<ctrl_t> f(GroupType::kWidth, empty);
276-
f[i] = full;
277-
EXPECT_EQ(i, GroupType{f.data()}.CountLeadingEmptyOrDeleted());
278-
}
279-
std::vector<ctrl_t> f(GroupType::kWidth, empty);
280-
f[GroupType::kWidth * 2 / 3] = full;
281-
f[GroupType::kWidth / 2] = full;
282-
EXPECT_EQ(GroupType::kWidth / 2,
283-
GroupType{f.data()}.CountLeadingEmptyOrDeleted());
284-
}
285-
}
286-
}
287-
288262
} // namespace
289263
} // namespace container_internal
290264
ABSL_NAMESPACE_END

absl/container/internal/raw_hash_set_benchmark.cc

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -519,17 +519,6 @@ void BM_Group_MaskNonFull(benchmark::State& state) {
519519
}
520520
BENCHMARK(BM_Group_MaskNonFull);
521521

522-
void BM_Group_CountLeadingEmptyOrDeleted(benchmark::State& state) {
523-
std::array<ctrl_t, Group::kWidth> group;
524-
Iota(group.begin(), group.end(), -2);
525-
Group g{group.data()};
526-
for (auto _ : state) {
527-
::benchmark::DoNotOptimize(g);
528-
::benchmark::DoNotOptimize(g.CountLeadingEmptyOrDeleted());
529-
}
530-
}
531-
BENCHMARK(BM_Group_CountLeadingEmptyOrDeleted);
532-
533522
void BM_Group_MatchFirstEmptyOrDeleted(benchmark::State& state) {
534523
std::array<ctrl_t, Group::kWidth> group;
535524
Iota(group.begin(), group.end(), -2);

absl/container/internal/raw_hash_set_resize_impl.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ struct ProbedItemImpl {
5252
static constexpr IntType kMaxNewBits = kMaxOldBits + 1;
5353
static constexpr IntType kMaxNewCapacity = (IntType{1} << kMaxNewBits) - 1;
5454

55-
static constexpr IntType kH2Shift = (kTotalBits - kH2Bits);
5655
static_assert(kMaxNewBits + kMaxOldBits + kH2Bits == kTotalBits);
5756

5857
ProbedItemImpl() = default;

0 commit comments

Comments
 (0)