From 548dff9c24a92c8da822b593e6302ff7044bc1d5 Mon Sep 17 00:00:00 2001
From: yangxianzhao <yangxianzhao@uniontech.com>
Date: Thu, 18 Jan 2024 16:09:43 +0800
Subject: [PATCH] add loongarch support

---
 src/common/classes/DbImplementation.cpp | 1 +
 src/common/common.h                     | 6 +++++-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/common/classes/DbImplementation.cpp b/src/common/classes/DbImplementation.cpp
index 95b1e33..4f2def6 100644
--- a/src/common/classes/DbImplementation.cpp
+++ b/src/common/classes/DbImplementation.cpp
@@ -39,6 +39,7 @@ static const UCHAR CpuPowerPc64 = 4;
 static const UCHAR CpuMipsel = 5;
 static const UCHAR CpuMips = 6;
 static const UCHAR CpuArm = 7;
+static const UCHAR CpuLoongarch64 = 19;
 static const UCHAR CpuIa64 = 8;
 static const UCHAR CpuS390 = 9;
 static const UCHAR CpuS390x = 10;
diff --git a/src/common/common.h b/src/common/common.h
index 9fbe954..1a0ef22 100644
--- a/src/common/common.h
+++ b/src/common/common.h
@@ -148,6 +148,10 @@
 #define RISC_ALIGNMENT
 #endif /* sparc */
 
+#ifdef _LOONGARCH_ARCH
+#define FB_CPU CpuLoongarch64
+#endif /* loongarch64 */
+
 #ifdef MIPSEL
 #define FB_CPU CpuMipsel
 #endif /* mipsel */
@@ -918,7 +922,7 @@ void GDS_breakpoint(int);
 // ASF: Currently, all little-endian are FB_SWAP_DOUBLE and big-endian aren't.
 // AP: Define it for your hardware correctly in case your CPU do not follow mentioned rule.
 //     The follwoing lines are kept for reference only.
-//#if defined(i386) || defined(I386) || defined(_M_IX86) || defined(AMD64) || defined(ARM) || defined(MIPSEL) || defined(DARWIN64) || defined(IA64)
+//#if defined(i386) || defined(I386) || defined(_M_IX86) || defined(AMD64) || defined(ARM) || defined(_LOONGARCH_ARCH) || defined(MIPSEL) || defined(DARWIN64) || defined(IA64)
 //#define		FB_SWAP_DOUBLE 1
 //#elif defined(sparc) || defined(PowerPC) || defined(PPC) || defined(__ppc__) || defined(HPUX) || defined(MIPS) || defined(__ppc64__)
 //#define		FB_SWAP_DOUBLE 0
-- 
2.31.1
