diff -Naur cfitsio-4.3.0.old/fitsio2.h cfitsio-4.3.0/fitsio2.h
--- cfitsio-4.3.0.old/fitsio2.h	2024-06-09 10:46:21.767372554 +0800
+++ cfitsio-4.3.0/fitsio2.h	2024-06-09 10:49:47.585360286 +0800
@@ -137,6 +137,11 @@
 #    error "can't handle long size given by _MIPS_SZLONG"
 #  endif
 
+#elif defined(__loongarch64) || defined(__loongarch64__)
+#define BYTESWAPPED TRUE
+#define MACHINE OTHERTYPE
+#define LONGSIZE 64
+
 #elif defined(__riscv)
 
 /* RISC-V is always little endian */
