xxx.asm

%define p1 ebp+8
%define p2 ebp+12
%define p3 ebp+16 section .text
global dllmain
export astrspn dllmain:
mov eax,1
ret 12 ;---------------------------------------------------;
; 返回不属于一组字符的字符串中第一个字符的索引
;---------------------------------------------------;
astrspn:
push ebp
mov ebp,esp
sub esp,8 mov edx,[p1] ; const char *str
mov ecx,[p2] ; const char *strCharSet
xor eax,eax ; 临时变量
mov [ebp-4],ecx
mov [ebp-8],ebx ;-------------------------------------;
; 遍历 str
;-------------------------------------;
.forStr:
mov bh,[edx]
test bh,bh
jz .return ;-------------------------------------;
; 遍历 strCharSet
;-------------------------------------;
.forStrCharSet:
mov bl,[ecx]
test bl,bl
jz .return ; 没找到退出函数 cmp bh,bl
je .forbreak ; 相等 next str inc ecx
jmp .forStrCharSet ; 不相等 next strCharSet .forbreak:
mov ecx,[ebp-4]
inc edx
inc eax
jmp .forStr .return:
mov ebx,[ebp-8]
add esp,8
mov esp,ebp
pop ebp
ret 8

c++:

#include <iostream>
#include <Windows.h> typedef int (CALLBACK* astrspn_t)(const char* str, const char* strCharSet);
astrspn_t astrspn; int main()
{
HMODULE myDLL = LoadLibraryA("xxx.dll");
astrspn = (astrspn_t)GetProcAddress(myDLL, "astrspn"); printf("%d\n", strspn( "abbbc", "ab")); // 4
printf("%d\n", astrspn("abbbc", "ab")); // 4
return 0;
}

nasm astrspn函数 x86的更多相关文章

  1. nasm astrcspn函数 x86

    xxx.asm %define p1 ebp+8 %define p2 ebp+12 %define p3 ebp+16 section .text global dllmain export ast ...

  2. nasm astrchr函数 x86

    xxx.asm: %define p1 ebp+8 %define p2 ebp+12 %define p3 ebp+16 section .text global dllmain export as ...

  3. nasm astrlen函数 x86

    xxx.asm %define p1 ebp+8 %define p2 ebp+12 %define p3 ebp+16 section .text global dllmain export ast ...

  4. nasm aat函数 x86

    xxx.asm: %define p1 ebp+8 %define p2 ebp+12 %define p3 ebp+16 section .text global dllmain dllmain: ...

  5. nasm astrstr函数 x86

    xxx.asm: %define p1 ebp+8 %define p2 ebp+12 %define p3 ebp+16 section .text global dllmain export as ...

  6. nasm astrset_s函数 x86

    xxx.asm %define p1 ebp+8 %define p2 ebp+12 %define p3 ebp+16 section .text global dllmain export ast ...

  7. nasm astrrev函数 x86

    xxx.asm %define p1 ebp+8 %define p2 ebp+12 %define p3 ebp+16 section .text global dllmain export ast ...

  8. nasm astrrchr函数 x86

    xxx.asm %define p1 ebp+8 %define p2 ebp+12 %define p3 ebp+16 section .text global dllmain export ast ...

  9. nasm astrncmp函数 x86

    xxx.asm: %define p1 ebp+8 %define p2 ebp+12 %define p3 ebp+16 section .text global dllmain export as ...

随机推荐

  1. GitLab开发流程图示、Git命令一张图

    GitLab开发流程图示.Git命令一张图 一.GitLab开发流程图示 二.Git命令一张图 作图工具:ProcessOn 一.GitLab开发流程图示 二.Git命令一张图

  2. Nginx 指定域名(或子域名)和网站绑定

    问题起因 博主最近在 CentOS 上面部署另外一个网站,但并不想通过端口号来访问,因为端口号对于 SEO 优化不利,且用户访问较繁琐(使用域名不就是为了方便用户访问吗?再引入端口号岂不是和使用域名的 ...

  3. 【STM32】时钟

    1. 在STM32中,有五个时钟源,为HSI.HSE.LSI.LSE.PLL: ① HSI是高速内部时钟,RC振荡器,频率为8MHz: ② HSE是高速外部时钟,可接石英/陶瓷谐振器,或者接外部时钟源 ...

  4. Kubernetes-5-2:Harbor仓库的几种高可用方案与搭建

    高可用Harbor搭建 思路及介绍 Harbor官方有推出主从架构和双主架构来实现Harbor的高可用及数据备份.   一.主从架构:  说白了,就是往一台Harbor仓库中push镜像,然后再通过这 ...

  5. Codeforces Round #655 (Div. 2) A. Omkar and Completion

    题目链接:https://codeforces.com/contest/1372/problem/A 题意 构造一个大小为 $n$ 的数组 $a$,要求满足 $1 \le a_i \le n$,且不存 ...

  6. Codeforces Round #627 (Div. 3) E - Sleeping Schedule(递推)

    题意: 每天有 h 小时,有一序列 an,每次可以选择 ai 或 ai - 1 小时后睡觉,问从 0 次 0 时开始,最多在 l ~ r 时间段入睡多少次. 思路: 如果此时可达,计算此时可达的时间点 ...

  7. HDU - 2825 Wireless Password (AC自动机+状压DP)

    题目连接:http://acm.hdu.edu.cn/showproblem.php?pid=2825 题意:给一些字符串,构造出长度为n的字符串,它至少包含k个所给字符串,求能构造出的个数. 题解: ...

  8. 2019HDU多校 Round9

    Solved:3 02 Rikka with Cake (树状数组) #include <bits/stdc++.h> using namespace std; typedef long ...

  9. 【noi 2.6_8464】股票买卖(DP)

    题意:N天可买卖2次股票,问最大利润. 解法:f[i]表示前 i 天买卖一次的最大利润,g[i]表示后 i 天. 注意--当天可以又买又卖,不要漏了这个要求:数据较大. 1 #include<c ...

  10. AtCoder Beginner Contest 184 E - Third Avenue (BFS)

    题意:给你一张图,\(S\)表示起点,\(G\)表示终点,\(.\)表示可以走,#表示不能走,小写字母可以传送到任意一个相同的字母的位置,问从\(S\)走到\(G\)的最小步数. 题解:假如不考虑字母 ...