|
22 | 22 | namespace storage { |
23 | 23 |
|
24 | 24 | // Names match Python names |
25 | | -using int64 = bh::dense_storage<uint64_t>; |
26 | | -using atomic_int64 = bh::dense_storage<bh::accumulators::count<uint64_t, true>>; |
| 25 | +using int64 = bh::dense_storage<int64_t>; |
| 26 | +using atomic_int64 = bh::dense_storage<bh::accumulators::count<int64_t, true>>; |
27 | 27 | using double_ = bh::dense_storage<double>; |
28 | 28 | using unlimited = bh::unlimited_storage<>; |
29 | 29 | using weight = bh::dense_storage<accumulators::weighted_sum<double>>; |
@@ -80,7 +80,7 @@ template <class Archive> |
80 | 80 | void save(Archive& ar, const storage::atomic_int64& s, unsigned /* version */) { |
81 | 81 | // We cannot view the memory as a numpy array, because the internal layout of |
82 | 82 | // std::atomic is undefined. So no reinterpret_casts are allowed. |
83 | | - py::array_t<std::uint64_t> a(static_cast<py::ssize_t>(s.size())); |
| 83 | + py::array_t<std::int64_t> a(static_cast<py::ssize_t>(s.size())); |
84 | 84 |
|
85 | 85 | auto in_ptr = s.begin(); |
86 | 86 | auto out_ptr = a.mutable_data(); |
@@ -191,15 +191,15 @@ struct type_caster<storage::atomic_int64::value_type> { |
191 | 191 | auto ptr = PyNumber_Long(src.ptr()); |
192 | 192 | if(!ptr) |
193 | 193 | return false; |
194 | | - value = PyLong_AsUnsignedLongLong(ptr); |
| 194 | + value = PyLong_AsLongLong(ptr); |
195 | 195 | Py_DECREF(ptr); |
196 | 196 | return !PyErr_Occurred(); |
197 | 197 | } |
198 | 198 |
|
199 | 199 | static handle cast(storage::atomic_int64::value_type src, |
200 | 200 | return_value_policy /* policy */, |
201 | 201 | handle /* parent */) { |
202 | | - return PyLong_FromUnsignedLongLong(src.value()); |
| 202 | + return PyLong_FromLongLong(src.value()); |
203 | 203 | } |
204 | 204 | }; |
205 | 205 | } // namespace detail |
|
0 commit comments