Skip to content

Commit defedd2

Browse files
committed
Fix 32 bit init
1 parent 27e92d6 commit defedd2

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

pandas/_libs/new_vector.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -116,9 +116,8 @@ template <typename T, bool IsMasked> class PandasHashTable {
116116
// uint32_t for the khash "int" size. Otherwise use 64 bits
117117
using HashValueT = typename std::conditional<sizeof(decltype(PandasHashFunction<T>()(T()))) <= 4, uint32_t, uint64_t>::type;
118118
explicit PandasHashTable<T, IsMasked>() = default;
119-
explicit PandasHashTable<T, IsMasked>(size_t new_size) {
120-
// TODO: C++20 std::in_range would be great to safely check cast
121-
hash_map_.resize(static_cast<HashValueT>(new_size));
119+
explicit PandasHashTable<T, IsMasked>(HashValueT new_size) {
120+
hash_map_.resize(new_size);
122121
}
123122

124123
auto __len__() const noexcept { return hash_map_.size(); }
@@ -678,7 +677,8 @@ using namespace nb::literals;
678677
do { \
679678
nb::class_<PandasHashTable<TYPE, MASKED>>(m, NAME) \
680679
.def(nb::init<>()) \
681-
.def(nb::init<size_t>(), "size_hint"_a) \
680+
.def(nb::init<uint32_t>(), "size_hint"_a) \
681+
.def(nb::init<uint64_t>(), "size_hint"_a) \
682682
.def("__len__", &PandasHashTable<TYPE, MASKED>::__len__) \
683683
.def("__contains__", &PandasHashTable<TYPE, MASKED>::__contains__) \
684684
.def("sizeof", &PandasHashTable<TYPE, MASKED>::SizeOf) \

0 commit comments

Comments
 (0)