Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3)

Side by Side Diff: wasm-tests/hello-putchar.c

Issue 1876413002: Subzero. WASM. Additional progress. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Merging with master Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 #include <stdio.h>
2 #include <string.h>
3 #include <unistd.h>
4
5 void write_int_(int fd, int n) {
6 if (n > 0) {
7 write_int_(fd, n / 10);
8
9 int rem = n % 10;
10 char c = '0' + rem;
11 write(fd, &c, 1);
12 }
13 }
14
15 void write_int(int fd, int n) {
16 if (n == 0) {
17 write(fd, "0", 1);
18 } else {
19 if (n < 0) {
20 write(fd, "-", 1);
21 write_int_(fd, -n);
22 } else {
23 write_int_(fd, n);
24 }
25 }
26 }
27
28 void stderr_int(int n) {
29 write_int(2, n);
30 write(2, "\n", 1);
31 }
32
33 int main(int argc, const char **argv) {
34 char *str = "Hello, World!\n";
35 for (int i = 0; str[i]; ++i) {
36 putchar(str[i]);
37
38 // write(2, "---\n", 4);
Jim Stichnoth 2016/04/14 20:03:44 Do these commented lines need to stay?
Eric Holk 2016/04/15 15:24:27 Nope. Done.
39 // write(2, "wpos: ", 6);
40 // stderr_int(((int *)stdout)[5]); //wpos
41 // write(2, "wend: ", 6);
42 // stderr_int(((int *)stdout)[4]); //wend
43 }
44 return 0;
45 }
OLDNEW
« src/WasmTranslator.cpp ('K') | « wasm-tests/hello-printf.c ('k') | wasm-tests/hello-puts.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698