write strcpy in asm and add some testing
This commit is contained in:
Родитель
645fcab6d3
Коммит
eb92e14f76
|
@ -4329,14 +4329,18 @@ LibraryManager.library = {
|
|||
}
|
||||
},
|
||||
|
||||
strcpy__asm: 'true',
|
||||
strcpy__sig: 'iii',
|
||||
strcpy: function(pdest, psrc) {
|
||||
pdest = pdest|0; psrc = psrc|0;
|
||||
var i = 0;
|
||||
do {
|
||||
{{{ makeCopyValues('pdest+i', 'psrc+i', 1, 'i8', null, 1) }}};
|
||||
i ++;
|
||||
} while ({{{ makeGetValue('psrc', 'i-1', 'i8') }}} != 0);
|
||||
return pdest;
|
||||
{{{ makeCopyValues('(pdest+i)|0', '(psrc+i)|0', 1, 'i8', null, 1) }}};
|
||||
i = (i+1)|0;
|
||||
} while (({{{ makeGetValue('psrc', 'i-1', 'i8') }}})|0 != 0);
|
||||
return pdest|0;
|
||||
},
|
||||
|
||||
stpcpy: function(pdest, psrc) {
|
||||
var i = 0;
|
||||
do {
|
||||
|
|
|
@ -4117,10 +4117,12 @@ The current type of b is: 9
|
|||
|
||||
#define CONSTRLEN 32
|
||||
|
||||
char * (*func)(char *, const char *) = NULL;
|
||||
|
||||
void conoutfv(const char *fmt)
|
||||
{
|
||||
static char buf[CONSTRLEN];
|
||||
strcpy(buf, fmt);
|
||||
func(buf, fmt); // call by function pointer to make sure we test strcpy here
|
||||
puts(buf);
|
||||
}
|
||||
|
||||
|
@ -4142,6 +4144,7 @@ The current type of b is: 9
|
|||
};
|
||||
|
||||
int main() {
|
||||
func = &strcpy;
|
||||
conoutfv("*staticccz*");
|
||||
printf("*%.2f,%.2f,%.2f*\\n", S::getIdentity().x, S::getIdentity().y, S::getIdentity().z);
|
||||
return 0;
|
||||
|
|
Загрузка…
Ссылка в новой задаче