Files
wasmtime/tests/debug/testsuite/reverse-str.c
Yury Delendik a88e26cc08 Utility methods for artificial debug types in the generated DWARF (#1482)
* add operator*
* add operator->
* add ptr() unwrap method
* comments/refactor
* macro_rules
* external symbols workaround
2020-04-10 11:00:10 -05:00

22 lines
413 B
C

// Compile with:
// clang --target=wasm32 reverse-str.c -o reverse-str.wasm -g \
// -O0 -nostdlib -fdebug-prefix-map=$PWD=.
#include <stdlib.h>
void reverse(char *s, size_t len)
{
if (!len) return;
size_t i = 0, j = len - 1;
while (i < j) {
char t = s[i];
s[i++] = s[j];
s[j--] = t;
}
}
void _start()
{
char hello[] = "Hello, world.";
reverse(hello, 13);
}