Skip to content

Commit

Permalink
Add constness for unmodified internal parameters.
Browse files Browse the repository at this point in the history
  • Loading branch information
JohannesWilde committed Dec 14, 2024
1 parent 753b434 commit 25a1994
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/numpy/ndarray.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ int bitflag_to_numpy(ndarray::bitflag f)

bool is_c_contiguous(std::vector<Py_intptr_t> const & shape,
std::vector<Py_intptr_t> const & strides,
int itemsize)
int const itemsize)
{
// An itemsize less than 0 is not useful - default to non-contiguity.
if (0 > itemsize) return false;
Expand All @@ -59,7 +59,7 @@ bool is_c_contiguous(std::vector<Py_intptr_t> const & shape,

bool is_f_contiguous(std::vector<Py_intptr_t> const & shape,
std::vector<Py_intptr_t> const & strides,
int itemsize)
int const itemsize)
{
// An itemsize less than 0 is not useful - default to non-contiguity.
if (0 > itemsize) return false;
Expand All @@ -76,7 +76,7 @@ bool is_f_contiguous(std::vector<Py_intptr_t> const & shape,
}

bool is_aligned(std::vector<Py_intptr_t> const & strides,
int itemsize)
int const itemsize)
{
// An itemsize less than 0 is not useful - default to non-aligned.
if (0 > itemsize) return false;
Expand Down Expand Up @@ -128,7 +128,7 @@ ndarray from_data_impl(void * data,
PyErr_SetString(PyExc_ValueError, "Length of shape and strides arrays do not match.");
python::throw_error_already_set();
}
int itemsize = dt.get_itemsize();
int const itemsize = dt.get_itemsize();
int flags = 0;
if (writeable) flags |= NPY_ARRAY_WRITEABLE;
if (is_c_contiguous(shape, strides, itemsize)) flags |= NPY_ARRAY_C_CONTIGUOUS;
Expand Down

0 comments on commit 25a1994

Please sign in to comment.