forked from haiwan/sledge
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
31 lines
511 B
31 lines
511 B
6 months ago
|
#include <stdlib.h>
|
||
|
#include <stdio.h>
|
||
|
#include <string.h>
|
||
|
#include <unistd.h>
|
||
|
|
||
|
#ifndef MAX_BUF
|
||
|
#define MAX_BUF (1024 * 1024 * 1) // 1m
|
||
|
#endif
|
||
|
|
||
|
//__attribute__((optnone)) int
|
||
|
int
|
||
|
main(void)
|
||
|
{
|
||
|
char *d = malloc(MAX_BUF + 1);
|
||
|
int r = read(0, d, MAX_BUF);
|
||
|
|
||
|
// unsigned long long st = getcycles(), en = 0;
|
||
|
// wrk();
|
||
|
// en = getcycles();
|
||
|
|
||
|
// if (r <= 0) printf("%llu\n", en > st ? (en - st)/CPU_CYCS : -1);
|
||
|
if (r < 0)
|
||
|
printf("E\n");
|
||
|
else if (r <= 1)
|
||
|
printf("D\n");
|
||
|
else
|
||
|
write(1, d, r);
|
||
|
|
||
|
return 0;
|
||
|
}
|