File tree Expand file tree Collapse file tree 4 files changed +8
-9
lines changed Expand file tree Collapse file tree 4 files changed +8
-9
lines changed Original file line number Diff line number Diff line change @@ -182,8 +182,9 @@ numpy_to_mpf_strided_loop(PyArrayMethod_Context *context,
182182 T *in = (T *)in_ptr;
183183 mpf_load (out, out_ptr, prec_out);
184184
185- int res = C_to_mpfr<conv_T, T>(*in, out);
186- // TODO: At least for ints, could flag out of bounds...
185+ C_to_mpfr<conv_T, T>(*in, out);
186+ // TODO: At least for ints, could flag out of bounds, the return value
187+ // of C_to_mpfr may help with that (it flags imprecisions).
187188 mpf_store (out_ptr, out);
188189
189190 in_ptr += strides[0 ];
Original file line number Diff line number Diff line change @@ -41,12 +41,12 @@ new_MPFDType_instance(mpfr_prec_t precision)
4141 }
4242 new -> precision = precision ;
4343 size_t size = mpfr_custom_get_size (precision );
44- if (size > NPY_MAX_INT - sizeof (mpf_field )) {
44+ if (size > NPY_MAX_INT - sizeof ( )) {
4545 PyErr_SetString (PyExc_TypeError ,
4646 "storage of single float would be too large for precision." );
4747 }
4848 new -> base .elsize = sizeof (mpf_storage ) + size ;
49- new -> base .alignment = _Alignof(mpf_storage );
49+ new -> base .alignment = _Alignof(mpf_field );
5050 new -> base .flags |= NPY_NEEDS_INIT ;
5151
5252 return new ;
@@ -242,7 +242,7 @@ PyArray_DTypeMeta MPFDType = {{{
242242 .tp_new = MPFDType_new ,
243243 .tp_repr = (reprfunc )MPFDType_repr ,
244244 .tp_str = (reprfunc )MPFDType_repr ,
245- .tp_getset = & mpfdtype_getsetlist ,
245+ .tp_getset = mpfdtype_getsetlist ,
246246 }},
247247 /* rest, filled in during DTypeMeta initialization */
248248};
Original file line number Diff line number Diff line change @@ -23,8 +23,6 @@ typedef struct {
2323 * So not storeing only those (saving 16 bytes of 48 for a 128 bit number)
2424 * removes the need to worry about this.
2525 */
26- static_assert (_Alignof(mpfr_t ) >= _Alignof(mp_limb_t ),
27- "mpfr_t storage not aligned as much as limb_t?!" );
2826typedef mpfr_t mpf_storage ;
2927
3028extern PyArray_DTypeMeta MPFDType ;
Original file line number Diff line number Diff line change @@ -209,8 +209,8 @@ PyTypeObject MPFloat_Type = {
209209 .tp_repr = (reprfunc )MPFloat_repr ,
210210 .tp_str = (reprfunc )MPFloat_str ,
211211 .tp_as_number = & mpf_as_number ,
212- .tp_richcompare = & mpf_richcompare ,
213- .tp_getset = & mpfloat_getsetlist ,
212+ .tp_richcompare = ( richcmpfunc ) mpf_richcompare ,
213+ .tp_getset = mpfloat_getsetlist ,
214214};
215215
216216
You can’t perform that action at this time.
0 commit comments