Skip to content

Commit 240b36f

Browse files
authored
Merge pull request numpy#17780 from kraj/rv32
ENH, BLD: Define RISCV-32 support
2 parents e88e37f + 0e2b652 commit 240b36f

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

numpy/_core/include/numpy/npy_cpu.h

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
* NPY_CPU_ARCEL
1919
* NPY_CPU_ARCEB
2020
* NPY_CPU_RISCV64
21+
* NPY_CPU_RISCV32
2122
* NPY_CPU_LOONGARCH
2223
* NPY_CPU_WASM
2324
*/
@@ -102,8 +103,12 @@
102103
#define NPY_CPU_ARCEL
103104
#elif defined(__arc__) && defined(__BIG_ENDIAN__)
104105
#define NPY_CPU_ARCEB
105-
#elif defined(__riscv) && defined(__riscv_xlen) && __riscv_xlen == 64
106-
#define NPY_CPU_RISCV64
106+
#elif defined(__riscv)
107+
#if __riscv_xlen == 64
108+
#define NPY_CPU_RISCV64
109+
#elif __riscv_xlen == 32
110+
#define NPY_CPU_RISCV32
111+
#endif
107112
#elif defined(__loongarch__)
108113
#define NPY_CPU_LOONGARCH
109114
#elif defined(__EMSCRIPTEN__)

numpy/_core/include/numpy/npy_endian.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
|| defined(NPY_CPU_PPC64LE) \
5050
|| defined(NPY_CPU_ARCEL) \
5151
|| defined(NPY_CPU_RISCV64) \
52+
|| defined(NPY_CPU_RISCV32) \
5253
|| defined(NPY_CPU_LOONGARCH) \
5354
|| defined(NPY_CPU_WASM)
5455
#define NPY_BYTE_ORDER NPY_LITTLE_ENDIAN

0 commit comments

Comments
 (0)