[Off] strcmp veloz
#4

pawn Код:
#include a_samp

#pragma tabsize 0

#define START_BENCH(%0); {new __a=%0,__b=0,__c,__d=GetTickCount(),__e=1;do{}\
    while(__d==GetTickCount());__c=GetTickCount();__d=__c;while(__c-__d<__a||\
    __e){if(__e){if(__c-__d>=__a){__e=0;__c=GetTickCount();do{}while(__c==\
    GetTickCount());__c=GetTickCount();__d=__c;__b=0;}}{


#define FINISH_BENCH(%0); }__b++;__c=GetTickCount();}printf(" Bench for "\
    %0": executes, by average, %.2f times/ms.",floatdiv(__b,__a));}


#define F1 "Que cor й os cabelos brancos de maria"
#define F2 "Que cor й os cabelos pretos de maria"

main()
{
    START_BENCH(1000);
    if(strcmp(F1, F2, true) == 0){

    }
    FINISH_BENCH("SA-MP");



    START_BENCH(1000);
    if(istrcmp(F1, F2) == 0){

    }
    FINISH_BENCH("SuYaNw");
}


istrcmp(str[], str2[], bool: per = true){

    if(strlen(str) > strlen(str2)) return -1;
    if(strlen(str) < strlen(str2)) return 1;

    if(!per){
        for(new i; str[i]; ++i){
            if(str[i] != str2[i]){
                return false;
            }
        }
    }else{
        for(new i; str[i]; ++i){
            if(tolower(str[i]) != tolower(str2[i])){
                return false;
            }
        }
    }
    return true;
}
Reply


Messages In This Thread
strcmp veloz - by ipsBruno - 30.09.2013, 05:26
Re: strcmp veloz - by zSuYaNw - 30.09.2013, 05:45
Re: strcmp veloz - by ipsBruno - 30.09.2013, 05:46
Re: strcmp veloz - by zSuYaNw - 30.09.2013, 05:50
Re: strcmp veloz - by ipsBruno - 30.09.2013, 05:54
Re: strcmp veloz - by ipsBruno - 30.09.2013, 06:15
Re: strcmp veloz - by zSuYaNw - 30.09.2013, 06:19
Re: strcmp veloz - by ipsBruno - 30.09.2013, 06:21
Re: strcmp veloz - by zSuYaNw - 30.09.2013, 06:22
Re: strcmp veloz - by ipsBruno - 30.09.2013, 06:25

Forum Jump:


Users browsing this thread: 1 Guest(s)