Réponse acceptée !
Fichier McrAsm.h
#ifndef MCRASM_H
#define MCRASM_H
#ifndef BNINLINE
#ifdef __cplusplus
#define BNINLINE inline
#else
#define BNINLINE __inline
#endif /* __cplusplus */
#endif /* BNINLINE */
BNINLINE char* bnstrcpy(char *dst, char *src) // return ptr sur NULL final
{
__asm {
mov eax, dst
mov ecx, src
dec eax
LcpyLoop:
mov dl, [ecx]
inc eax
inc ecx
mov [eax], dl
or dl, dl
jz short LcpyOut
mov dl, [ecx]
inc eax
inc ecx
mov [eax], dl
or dl, dl
jz short LcpyOut
mov dl, [ecx]
inc eax
inc ecx
mov [eax], dl
or dl, dl
jnz short LcpyLoop
LcpyOut:
}
}
#endif
Te reste à ajouter
#include "McrAsm.h"
dans les modules qui voudront utiliser bnstrcpy().
Exemple:
char szA[] = "Salut";
char szB[] = " la foule";
char buf[48], *c;
c = bnstrcpy(buf, szA);
bnstrcpy(c, szB);
qu'on pourra condenser en:
bnstrcpy(bnstrcpy(buf, szA), szB);
ciao...
BruNews, MVP VC++