From d10578d267aa9e8cc54f8c81195cd6b407441982 Mon Sep 17 00:00:00 2001 From: zzy <2450266535@qq.com> Date: Sun, 20 Sep 2026 18:03:56 +0800 Subject: [PATCH] =?UTF-8?q?stage2=20=E8=A7=A3=E5=86=B3=E7=B1=BB=E5=9E=8B?= =?UTF-8?q?=E9=87=8D=E5=A4=8D=E5=AF=BC=E5=85=A5=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- stage0/include/core_map.h | 10 +++++++++- stage2/sys/spl_rt.h | 8 ++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/stage0/include/core_map.h b/stage0/include/core_map.h index bb42b76..f1cdbd6 100644 --- a/stage0/include/core_map.h +++ b/stage0/include/core_map.h @@ -9,8 +9,16 @@ #ifndef nullptr #define nullptr NULL #endif + +#ifndef SPL_USIZE +#define SPL_USIZE typedef uintptr_t usize; +#endif + +#ifndef SPL_ISIZE +#define SPL_ISIZE typedef intptr_t isize; +#endif #define MAP_TYPEOF __typeof__ @@ -165,7 +173,7 @@ static inline usize map_hash_str(const char *s) { while ((map).data[_idx].state != __MAP_SLOT_EMPTY) { \ if ((map).data[_idx].state == __MAP_SLOT_OCCUPIED && \ (map).cmp((map).data[_idx].key, _key) == 0) { \ - break; /* 已存在,不更新 */ \ + break; /* 已存在,不更新 */ \ } \ if ((map).data[_idx].state == __MAP_SLOT_DELETED && _first_del == (usize) - 1) \ _first_del = _idx; \ diff --git a/stage2/sys/spl_rt.h b/stage2/sys/spl_rt.h index 56d1382..4f935d8 100644 --- a/stage2/sys/spl_rt.h +++ b/stage2/sys/spl_rt.h @@ -31,8 +31,16 @@ typedef unsigned int u32; typedef signed int i32; typedef unsigned long long u64; typedef signed long long i64; + +#ifndef SPL_USIZE typedef u64 usize; +#define SPL_USIZE +#endif + +#ifndef SPL_ISIZE typedef i64 isize; +#define SPL_ISIZE +#endif /* 注:不定义 bool/true/false,避免与 C23 关键字冲突;生成代码用 u8 表示布尔。 */ /* ---- panic / trap ---- */