加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0002-fix-some-clean-code-problem.patch 2.80 KB
一键复制 编辑 原始数据 按行查看 历史
RenoSeven 提交于 2024-09-18 18:40 . release 1.2.2-2
From 2f41eb92cb97ba980ac4d9d7b6b39d001687c111 Mon Sep 17 00:00:00 2001
From: liqiang <liqiang64@huawei.com>
Date: Thu, 29 Aug 2024 03:56:58 +0800
Subject: [PATCH] fix some clean code problem
Signed-off-by: liqiang <liqiang64@huawei.com>
---
upatch-diff/insn/asm/inat.h | 8 ++++----
upatch-diff/insn/inat.c | 6 +++---
upatch-diff/insn/insn.c | 6 +++---
3 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/upatch-diff/insn/asm/inat.h b/upatch-diff/insn/asm/inat.h
index f446ad8..4ab84d6 100644
--- a/upatch-diff/insn/asm/inat.h
+++ b/upatch-diff/insn/asm/inat.h
@@ -156,7 +156,7 @@ static inline int inat_is_escape(insn_attr_t attr)
return attr & INAT_ESC_MASK;
}
-static inline int inat_escape_id(insn_attr_t attr)
+static inline unsigned int inat_escape_id(insn_attr_t attr)
{
return (attr & INAT_ESC_MASK) >> INAT_ESC_OFFS;
}
@@ -166,7 +166,7 @@ static inline int inat_is_group(insn_attr_t attr)
return attr & INAT_GRP_MASK;
}
-static inline int inat_group_id(insn_attr_t attr)
+static inline unsigned int inat_group_id(insn_attr_t attr)
{
return (attr & INAT_GRP_MASK) >> INAT_GRP_OFFS;
}
@@ -181,7 +181,7 @@ static inline int inat_has_immediate(insn_attr_t attr)
return attr & INAT_IMM_MASK;
}
-static inline int inat_immediate_size(insn_attr_t attr)
+static inline unsigned int inat_immediate_size(insn_attr_t attr)
{
return (attr & INAT_IMM_MASK) >> INAT_IMM_OFFS;
}
@@ -220,4 +220,4 @@ static inline int inat_must_vex(insn_attr_t attr)
{
return attr & INAT_VEXONLY;
}
-#endif
\ No newline at end of file
+#endif
diff --git a/upatch-diff/insn/inat.c b/upatch-diff/insn/inat.c
index 193583f..cb5aec6 100644
--- a/upatch-diff/insn/inat.c
+++ b/upatch-diff/insn/inat.c
@@ -43,7 +43,7 @@ insn_attr_t inat_get_escape_attribute(insn_byte_t opcode, int lpfx_id,
insn_attr_t esc_attr)
{
const insn_attr_t *table;
- int n;
+ unsigned int n;
n = inat_escape_id(esc_attr);
@@ -62,7 +62,7 @@ insn_attr_t inat_get_group_attribute(insn_byte_t modrm, int lpfx_id,
insn_attr_t grp_attr)
{
const insn_attr_t *table;
- int n;
+ unsigned int n;
n = inat_group_id(grp_attr);
@@ -95,4 +95,4 @@ insn_attr_t inat_get_avx_attribute(insn_byte_t opcode, insn_byte_t vex_m,
return 0;
}
return table[opcode];
-}
\ No newline at end of file
+}
diff --git a/upatch-diff/insn/insn.c b/upatch-diff/insn/insn.c
index d9a356b..7880eed 100644
--- a/upatch-diff/insn/insn.c
+++ b/upatch-diff/insn/insn.c
@@ -574,6 +574,6 @@ void insn_get_length(struct insn *insn)
return;
if (!insn->immediate.got)
insn_get_immediate(insn);
- insn->length = (unsigned char)((unsigned long)insn->next_byte
- - (unsigned long)insn->kaddr);
-}
\ No newline at end of file
+ insn->length = (unsigned char)((unsigned long)insn->next_byte -
+ (unsigned long)insn->kaddr);
+}
--
2.34.1
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化