将 c++ for 循环更改为 x86
Changing c++ for loop into x86
目前我正在学习 x86 汇编作为我的 uni 模块之一,我有一个用 C++ 编写的程序,它采用 6 个字符的字符串并根据加密密钥对其进行加密。
encrypt_chars的代码:
void encrypt_chars(int length, char EKey)
{
char temp_char; // char temporary store
for (int i = 0; i < length; i++) // encrypt characters one at a time
{
temp_char = OChars[i]; //
__asm { //
push eax
push ecx
lea eax, EKey
push temp_char
push eax
call encrypt21
mov temp_char, al
add esp, 8
pop ecx
pop eax
}
EChars[i] = temp_char; // Store encrypted char in the encrypted chars array
}
return;
}
我希望得到一些关于如何将代码顶部的 for 循环更改为汇编语言的帮助,谢谢。
阅读有关 jmp 和读取变量并保存到寄存器的信息。我会给你举个例子,你可以阅读像 var(,%esi,4) 这样的变量,其中 var 是 yor 变量的名称,esi 是递增寄存器,4 是你的单词有多长。查看英特尔文档
相关文章:
- 如何循环打印顶点结构
- 如何在C++中从两个单独的for循环中添加两个数组
- C++我的数学有什么问题,为什么我的代码不能正确循环
- 正在尝试了解输入验证循环
- std::map<struct,struct>::find 找不到匹配项,但是如果我循环通过 begin() 到 end(),我在那里看到匹配项
- 循环后如何继续阅读
- Ardunio UNO解决了多个重叠的定时器循环
- Eigen如何在容器循环中干净地附加矩阵
- 在某些循环内使用vector.push_back时出现分段错误
- 我正在使用嵌套的while循环来解析具有多行的文本文件,但由于某种原因,它只通过第一行,我不知道为什么
- 为什么我的for循环不能正确获取argv
- 如何声明特征矩阵,然后通过嵌套循环初始化它
- while循环中while循环的时间复杂度是多少
- C++中的高效循环缓冲区,它将被传递给C样式数组函数参数
- 为什么在这个代码结束循环中没有得到结束
- 在基于范围的for循环中使用结构化绑定声明
- 将 c++ for 循环更改为 x86
- x86 汇编和优化代码中的 for 循环
- x86-64 汇编程序中的无限循环
- 为什么使用GCC的x86上的整数溢出会导致无限循环