boostorg / boostorg/python

Add method to numpy::dtype to set byteorder

Open
#230 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
537
Forks
223
Avg merge
11h 22m
Merged PRs (30d)
2

Description

I've taken a look at `numpy/dtype.hpp`, and there does not appear to be any way to set the byte order of the array being constructed. The workaround I am currently using (which requires adding the numpy C API to my build and including the headers in my source) is the following:

```
np::dtype scalarDtype = np::dtype::get_builtin();
reinterpret_cast(scalarDtype.ptr())->byteorder = '>';
```

So it should be as simple as adding a method to dtype to allow the user to set the byteorder on the underlying numpy struct.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.