Skip to content

Commit

Permalink
Merge pull request #3 from Sunday111/countr_zero
Browse files Browse the repository at this point in the history
Replace custom bitscan with std::countr_zero
  • Loading branch information
Sunday111 authored Oct 28, 2024
2 parents 90f45c3 + 8b453e1 commit 6bb0065
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 83 deletions.
70 changes: 0 additions & 70 deletions include/ass/bit/bit_scan_constexpr.hpp

This file was deleted.

8 changes: 4 additions & 4 deletions include/ass/fixed_bitset.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
#include <bit>
#include <cassert>
#include <cstddef>
#include <limits>

#include "bit/bit_count_to_type.hpp"
#include "bit/bit_scan_constexpr.hpp"

namespace ass::fixed_bitset_detail
{
Expand Down Expand Up @@ -110,7 +110,7 @@ class FixedBitset
for (size_t part_index = 0; part_index != parts_.size(); ++part_index)
{
const Part& part = parts_[part_index];
const size_t local = BitScanConstexpr(part);
const size_t local = std::countr_zero(part);
result += local;
if (local != kPartBitsCount)
{
Expand All @@ -134,7 +134,7 @@ class FixedBitset
mask = ~mask;
mask <<= ignored_bits;
const Part part = parts_[part_index] & mask;
const size_t local = BitScanConstexpr(part);
const size_t local = std::countr_zero(part);
if (local != kPartBitsCount)
{
return result + local;
Expand All @@ -147,7 +147,7 @@ class FixedBitset
for (; part_index != parts_.size(); ++part_index)
{
const Part& part = parts_[part_index];
const size_t local = BitScanConstexpr(part);
const size_t local = std::countr_zero(part);
result += local;
if (local != kPartBitsCount)
{
Expand Down
9 changes: 0 additions & 9 deletions tests/bit/bit_scan_test.cpp

This file was deleted.

0 comments on commit 6bb0065

Please sign in to comment.