begin process at 2012 05 24 03:52:15
  Trouver un code source :
 
dans
 
Accueil > 

Code

 > 

Delphi et asm

 > RENVOIT UNE CHAINE DE X FOIS LE CARACTÈRE DEMANDÉ

RENVOIT UNE CHAINE DE X FOIS LE CARACTÈRE DEMANDÉ


 Information sur la source

Note :
8 / 10 - par 1 personne
8,00 / 10

  • 1

  • 2

  • 3

  • 4

  • 5

  • 6

  • 7

  • 8

  • 9

  • 10
Catégorie :Delphi et asm Niveau :Débutant Date de création :03/09/2003 Date de mise à jour :03/09/2003 02:51:32 Vu :3 173

Auteur : cutmaster

Ecrire un message privé
Commentaire sur cette source (0)
Ajouter un commentaire et/ou une note

 Description

Ecrite uniquement pour optimiser la version Delphi.
Cette fonction renvoit un shortstring contenant "Nb" fois le caractère "Car".

Source

  • Function RepCar(Car:Char; Nb:Byte):ShortString; Assembler;
  • Asm
  • // original delphi coded version : 26 lines and 2 external procedures call, now it's 10 lines
  • push edi
  • mov edi,@Result
  • mov ebx,eax // save needed car (EAX) into ebx
  • mov al,dl // now take the number of chars (EDX) into al
  • stosb // and store it ;)
  • xor ecx,ecx
  • mov cl,dl // say we want Nb Chars
  • mov al,bl // of this char
  • rep stosb // and repeat ;)
  • pop edi
  • End;
Function RepCar(Car:Char; Nb:Byte):ShortString; Assembler;
Asm
    // original delphi coded version : 26 lines and 2 external procedures call, now it's 10 lines
    push   edi

    mov    edi,@Result
    mov    ebx,eax             // save needed car (EAX) into ebx
    mov    al,dl               // now take the number of chars (EDX) into al
    stosb                      // and store it ;)
    xor    ecx,ecx
    mov    cl,dl               // say we want Nb Chars
    mov    al,bl               // of this char
    rep    stosb               // and repeat ;)

    pop    edi
End;



 Sources du même auteur

PETIT ÉQUIVALENT DU ?: DU C EN DELPHI POUR LES CHAINES, LONG...
AVOIR LE NOM DU JOUR DE LA SEMAINE DÉSIGNÉ
REMPLISSAGE FORMATÉ D'UN SHORTSTRING

 Sources de la même categorie

Source avec Zip APPELER UNE API EN ASM AVEC DELPHI par DeadlyPredator
PETIT ÉQUIVALENT DU ?: DU C EN DELPHI POUR LES CHAINES, LONG... par cutmaster
AVOIR LE NOM DU JOUR DE LA SEMAINE DÉSIGNÉ par cutmaster
REMPLISSAGE FORMATÉ D'UN SHORTSTRING par cutmaster
3 FONCTIONS GRAPHIQUES PLUS RAPIDES QUE LES FONCTIONS DE BAS... par balgrim

Commentaires et avis

Aucun commentaire pour le moment.

 Ajouter un commentaire




Nos sponsors


Sondage...

CalendriCode

Mai 2012
LMMJVSD
 123456
78910111213
14151617181920
21222324252627
28293031   

Consulter la suite du CalendriCode

A découvrir



 
Développement réalisé par Nicolas SOREL (Nix) avec l'aide de : Cyril DURAND et Emmanuel (EBArtSoft), Merci à Vincent pour ses précieux conseils.
CodeS-SourceS.com© Toute reproduction même partielle est interdite sauf accord écrit du Webmaster
CodeS-SourceS.com© est une marque déposée tous droits réservés

Google Coop CodeS-SourceS Google Coop CodeS-SourceS
Temps d'éxécution de la page : 1,482 sec (3)

Nous contacter | Annoncer sur CodeS-SourceS | Mentions légales