nasm astrcspn函数 x86
xxx.asm
%define p1 ebp+8
%define p2 ebp+12
%define p3 ebp+16
section .text
global dllmain
export astrcspn
dllmain:
mov eax,1
ret 12
;---------------------------------------------------;
; 返回属于一组字符的字符在字符串中第一次出现的索引
;---------------------------------------------------;
astrcspn:
push ebp
mov ebp,esp
sub esp,8
mov edx,[p1] ; char ptr 1
mov ecx,[p2] ; char ptr 2
xor eax,eax
; 保存str2指针,和ebx寄存器
mov [ebp-4],ecx
mov [ebp-8],ebx
;-------------------------------------;
; 遍历 str1
;-------------------------------------;
.forStr1:
mov bh,[edx]
test bh,bh
jz .return
;-------------------------------------;
; 遍历str2,如果相等退出函数
;-------------------------------------;
.forStr2:
mov bl,[ecx]
test bl,bl
jz .forbreak
cmp bh,bl
je .return
inc ecx
jmp .forStr2
.forbreak:
mov ecx,[ebp-4]
inc edx
inc eax
jmp .forStr1
;-------------------------------------;
; 恢复ebx寄存器,恢复堆栈
;-------------------------------------;
.return:
mov ebx,[ebp-8]
add esp,8
mov esp,ebp
pop ebp
ret 8
c++:
#include <iostream>
#include <Windows.h>
typedef size_t (CALLBACK* astrcspn_t)(const char* str1, const char* str2);
astrcspn_t astrcspn;
int main()
{
HMODULE myDLL = LoadLibraryA("xxx.dll");
astrcspn = (astrcspn_t)GetProcAddress(myDLL, "astrcspn");
const char* str1 = "fcba73";
const char* str2 = "1234567890";
printf("%d\n", strcspn(str1, str2)); // 4
printf("%d\n", astrcspn(str1, str2)); // 4
return 0;
}
nasm astrcspn函数 x86的更多相关文章
- nasm astrspn函数 x86
xxx.asm %define p1 ebp+8 %define p2 ebp+12 %define p3 ebp+16 section .text global dllmain export ast ...
- nasm astrchr函数 x86
xxx.asm: %define p1 ebp+8 %define p2 ebp+12 %define p3 ebp+16 section .text global dllmain export as ...
- nasm astrlen函数 x86
xxx.asm %define p1 ebp+8 %define p2 ebp+12 %define p3 ebp+16 section .text global dllmain export ast ...
- nasm aat函数 x86
xxx.asm: %define p1 ebp+8 %define p2 ebp+12 %define p3 ebp+16 section .text global dllmain dllmain: ...
- nasm astrstr函数 x86
xxx.asm: %define p1 ebp+8 %define p2 ebp+12 %define p3 ebp+16 section .text global dllmain export as ...
- nasm astrset_s函数 x86
xxx.asm %define p1 ebp+8 %define p2 ebp+12 %define p3 ebp+16 section .text global dllmain export ast ...
- nasm astrrev函数 x86
xxx.asm %define p1 ebp+8 %define p2 ebp+12 %define p3 ebp+16 section .text global dllmain export ast ...
- nasm astrrchr函数 x86
xxx.asm %define p1 ebp+8 %define p2 ebp+12 %define p3 ebp+16 section .text global dllmain export ast ...
- nasm astrncmp函数 x86
xxx.asm: %define p1 ebp+8 %define p2 ebp+12 %define p3 ebp+16 section .text global dllmain export as ...
随机推荐
- Centos虚拟机上安装部署Tenginx,以及部署过程中遇到的问题
Tenginx下载网址: Tenginx 官网地址:http://tengine.taobao.org/ Tenginx的官方网址中可以阅读Nginx的文档,可以选择中文进行阅读.下载Tengine- ...
- 阿里一面,给了几条SQL,问需要执行几次树搜索操作?
前言 有位朋友去阿里面试,他说面试官给了几条查询SQL,问:需要执行几次树搜索操作?我朋友当时是有点懵的,后来冷静思考,才发现就是考索引的几个基础知识点~~ 本文我们分九个索引知识点,一起来探讨一下. ...
- Flink-v1.12官方网站翻译-P004-Flink Operations Playground
Flink操作训练场 在各种环境中部署和操作Apache Flink的方法有很多.无论这种多样性如何,Flink集群的基本构件保持不变,类似的操作原则也适用. 在这个操场上,你将学习如何管理和运行Fl ...
- 理解了这三点,才敢说自己会写Python代码
某同学应聘Python岗位被录用.上班第一天,Leader吩咐他写一个获取次日日期信息的函数.该同学信心满满地写下了这样一段代码, 然后就没有然后了. import time def get_next ...
- 一周精彩内容分享(第 1 期):"世纪逼空大战"
这里记录过去一周,我看到的值得分享的东西. 一方面是整理记录一下自己一周的学习,另一方面也是期待自己有更多的输出,有更多的价值. 周刊开源(Github:wmyskxz/weekly),欢迎提交 is ...
- HDU-3240(卡特兰数+分解质因数后求逆元)
卡特兰数相关公式 : \(H_n = {C_{2n}^n \over n+1)}\) \(H_n = {(4n-2)\over n+1}\times H_{n-1}\) \(H_n = C_{2n}^ ...
- poj3415 Common Substrings (后缀数组+单调队列)
Time Limit: 5000MS Memory Limit: 65536K Total Submissions: 9414 Accepted: 3123 Description A sub ...
- Codeforces Round #652 (Div. 2) E. DeadLee 贪心
题意: 派会上有n种食物,每种食物有wi份.有m个朋友,每一个朋友有两种他喜欢吃的食物xi,yi.你需要判断他的朋友是否都能吃到食物.如果都能吃到食物,那么要输出朋友来的顺序,不能的话输出" ...
- Atcoder ABC162 D - RGB Triplets
传送门:D - RGB Triplets 题意:给你一个只含'R','G','B'的字符串,求有多少个长度为3且每个字符都不相等,并且第一第二和第二第三的区间长度不同的子序列. 题解:统计每个字符各 ...
- tomacat服务器上web资源访问流程、web应用打成war包发布、Context的reloadable属性、tomacat体系架构
一.web资源访问流程 二.web应用打成war包发布到服务器 好处:打成war包发布到服务器,那么服务器会自动把它拆解成文件夹 jar命令是java自带的一个命令,如果之前配置过Java编译环境就可 ...