30.09.2013, 05:50
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;
}