asmify strncpy
This commit is contained in:
Родитель
eb92e14f76
Коммит
7e2e2380a7
|
@ -4350,14 +4350,18 @@ LibraryManager.library = {
|
|||
return pdest + i - 1;
|
||||
},
|
||||
|
||||
strncpy__asm: 'true',
|
||||
strncpy__sig: 'iiii',
|
||||
strncpy: function(pdest, psrc, num) {
|
||||
var padding = false, curr;
|
||||
for (var i = 0; i < num; i++) {
|
||||
curr = padding ? 0 : {{{ makeGetValue('psrc', 'i', 'i8') }}};
|
||||
pdest = pdest|0; psrc = psrc|0; num = num|0;
|
||||
var padding = 0, curr = 0, i = 0;
|
||||
while ((i|0) < (num|0)) {
|
||||
curr = padding ? 0 : {{{ makeGetValueAsm('psrc', 'i', 'i8') }}};
|
||||
{{{ makeSetValue('pdest', 'i', 'curr', 'i8') }}}
|
||||
padding = padding || {{{ makeGetValue('psrc', 'i', 'i8') }}} == 0;
|
||||
padding = padding | ({{{ makeGetValueAsm('psrc', 'i', 'i8') }}} == 0);
|
||||
i = (i+1)|0;
|
||||
}
|
||||
return pdest;
|
||||
return pdest|0;
|
||||
},
|
||||
|
||||
strlwr__deps:['tolower'],
|
||||
|
|
|
@ -1890,13 +1890,24 @@ Succeeded!
|
|||
printf("%s\\n", strdup_val);
|
||||
free(strdup_val);
|
||||
|
||||
{
|
||||
char *one = "one 1 ONE !";
|
||||
char *two = "two 2 TWO ?";
|
||||
char three[1024];
|
||||
memset(three, '.', 1024);
|
||||
three[50] = 0;
|
||||
strncpy(three + argc, one + (argc/2), argc+1);
|
||||
strncpy(three + argc*3, two + (argc/3), argc+2);
|
||||
printf("waka %s\\n", three);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
'''
|
||||
for named in (0, 1):
|
||||
print named
|
||||
Settings.NAMED_GLOBALS = named
|
||||
self.do_run(src, '4:10,177,543,def\n4\nwowie\ntoo\n76\n5\n(null)\n/* a comment */\n// another\ntest\n', ['wowie', 'too', '74'])
|
||||
self.do_run(src, '4:10,177,543,def\n4\nwowie\ntoo\n76\n5\n(null)\n/* a comment */\n// another\ntest\nwaka ....e 1 O...wo 2 T................................\n', ['wowie', 'too', '74'])
|
||||
if self.emcc_args == []:
|
||||
gen = open(self.in_dir('src.cpp.o.js')).read()
|
||||
assert ('var __str1;' in gen) == named
|
||||
|
|
Загрузка…
Ссылка в новой задаче