nvidia-texture-tools/nvidia-texture-tools-riscv6...

53 lines
1.8 KiB
Diff

diff --git a/src/nvcore/nvcore.h b/src/nvcore/nvcore.h
index 77ca744..29140a7 100644
--- a/src/nvcore/nvcore.h
+++ b/src/nvcore/nvcore.h
@@ -80,6 +80,10 @@
# define NV_CPU_MIPS64 1
#elif defined POSH_CPU_S390
# define NV_CPU_S390 1
+#elif defined POSH_CPU_RISCV32
+# define NV_CPU_RISCV32 1
+#elif defined POSH_CPU_RISCV64
+# define NV_CPU_RISCV64 1
#else
# error "Unsupported CPU"
#endif
diff --git a/src/nvcore/poshlib/posh.h b/src/nvcore/poshlib/posh.h
index ca7641b..972eae5 100644
--- a/src/nvcore/poshlib/posh.h
+++ b/src/nvcore/poshlib/posh.h
@@ -486,6 +486,23 @@ Metrowerks:
# endif
#endif
+/* ------------------------------------------------------------------
+** RISC-V
+** ------------------------------------------------------------------
+*/
+#if defined __riscv && defined __riscv_xlen
+# if __riscv_xlen == 32
+# define POSH_CPU_RISCV32 1
+# define POSH_CPU_STRING "RISCV32"
+# elif __riscv_xlen == 64
+# define POSH_CPU_RISCV64 1
+# define POSH_CPU_STRING "RISCV64"
+# else
+# error "Unsupported XLEN for RISC-V!"
+# endif
+#endif
+
+
#if defined mips || defined __mips__ || defined __MIPS__ || defined _MIPS
# if defined __mips64
# define POSH_CPU_MIPS64 1
@@ -669,7 +686,7 @@ Metrowerks:
** the MIPS series, so we have to be careful about those.
** ----------------------------------------------------------------------------
*/
-#if defined POSH_CPU_X86 || defined POSH_CPU_AXP || defined POSH_CPU_STRONGARM || defined POSH_OS_WIN32 || defined POSH_OS_WINCE || defined __MIPSEL__ || defined POSH_CPU_AARCH64
+#if defined POSH_CPU_X86 || defined POSH_CPU_AXP || defined POSH_CPU_STRONGARM || defined POSH_OS_WIN32 || defined POSH_OS_WINCE || defined __MIPSEL__ || defined POSH_CPU_AARCH64 || defined POSH_CPU_RISCV32 || defined POSH_CPU_RISCV64
# define POSH_ENDIAN_STRING "little"
# define POSH_LITTLE_ENDIAN 1
#else