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

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: Code review feedback and 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
« no previous file with comments | « wasm-tests/hello-printf.c ('k') | wasm-tests/hello-puts.c » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 return 0;
39 }
OLDNEW
« no previous file with comments | « 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