Просмотр исходного кода

PopCount => std::popcount
commit_hash:b648a03fff23eec34a775607e9435d77a885a27a

tobo 4 месяцев назад
Родитель
Сommit
a76b79c4e2

+ 4 - 4
library/cpp/containers/bitseq/bititerator.h

@@ -1,8 +1,8 @@
 #pragma once
 
 #include "traits.h"
+#include <bit>
 
-#include <library/cpp/pop_count/popcount.h>
 
 template <typename T>
 class TBitIterator {
@@ -49,7 +49,7 @@ public:
         if (!Mask)
             return *Data & TTraits::ElemMask(count);
 
-        auto usedBits = (size_t)PopCount(Mask - 1);
+        auto usedBits = (size_t)std::popcount(Mask - 1u);
         TWord result = Current >> usedBits;
         auto leftInCurrent = TTraits::NumBits - usedBits;
         if (count <= leftInCurrent)
@@ -72,7 +72,7 @@ public:
             return Current & TTraits::ElemMask(count);
         }
 
-        auto usedBits = (size_t)PopCount(Mask - 1);
+        auto usedBits = (size_t)std::popcount(Mask - 1u);
         TWord result = Current >> usedBits;
         auto leftInCurrent = TTraits::NumBits - usedBits;
         if (count < leftInCurrent) {
@@ -97,7 +97,7 @@ public:
         if (!count)
             return;
 
-        int leftInCurrent = (size_t)PopCount(~(Mask - 1));
+        int leftInCurrent = std::popcount(static_cast<TWord>(~(Mask - 1u)));
         if (count < leftInCurrent) {
             Mask <<= count;
             return;

+ 3 - 2
library/cpp/containers/bitseq/bitvector.h

@@ -2,11 +2,12 @@
 
 #include "traits.h"
 
-#include <library/cpp/pop_count/popcount.h>
 
 #include <util/generic/vector.h>
 #include <util/ysaveload.h>
 
+#include <bit>
+
 template <typename T>
 class TReadonlyBitVector;
 
@@ -113,7 +114,7 @@ public:
     size_t Count() const {
         size_t count = 0;
         for (size_t i = 0; i < Data_.size(); ++i) {
-            count += (size_t)PopCount(Data_[i]);
+            count += (size_t)std::popcount(Data_[i]);
         }
         return count;
     }

+ 0 - 1
library/cpp/containers/bitseq/ya.make

@@ -2,7 +2,6 @@ LIBRARY()
 
 PEERDIR(
     util/draft
-    library/cpp/pop_count
 )
 
 SRCS(