File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ // -nostdlib -ffreestanding
2+
3+ //gcc -nostdlib -static
4+
5+ #include <stdint.h>
6+ asm(".global _start;_start:;xorl %ebp,%ebp;movq 0(%rsp),%rdi;lea 8(%rsp),%rsi;call main;" );
7+ asm("Exit:;movq %rax,%rdi;movq $60,%rax;syscall;\n" );
8+ asm("F64sqrt:sqrtsd %xmm0,%xmm0;ret;\n" );
9+
10+ void Exit (int x );
11+ double F64sqrt (double );
12+
13+ /*
14+ asm("write:;movq $1,%rax;syscall;ret;\n");
15+ asm("F64abs:xor %eax,%eax;dec %rax;shr %rax;movq %rax,%xmm1;andpd %xmm1,%xmm0;ret;");
16+ asm("F64min:minsd %xmm0,%xmm0;ret;\n");
17+ asm("F64max:maxsd %xmm0,%xmm0;ret;\n");
18+
19+ double F64abs(double);
20+ double F64min(double);
21+ double F64max(double);
22+ double F64copysign(double x,double y){union{double f;uint64_t i;}ux={x},uy={y};ux.i&=-1ull/2;ux.i|=uy.i&1ull<<63;return ux.f;}
23+ double F64floor(double x){int i=(int)x;return(double)i;}
24+
25+ int write(int fd, const void *buf, unsigned count);
26+ int ns(char*c){char *p;for(p=c;*p;++p);return p-c;}
27+ */
28+
29+ void main (int args ,char * argv []){
30+ /*
31+ for(int i=0;i<args;++i){
32+ int n=ns(argv[i]);
33+ write(1,argv[i],n);
34+ write(1,"\n",1);
35+ }
36+ */
37+ Exit ((int64_t )F64sqrt ((double )args ));
38+ }
Load diff This file was deleted.
Original file line number Diff line number Diff line change 44#go install /c/k/wg/cmd/wg
55#wg -k .. > k.k
66
7+ gcc -nostdlib -static l86.c
8+ exit 0
9+
710if [ "$1" = "go" ]; then
811 k k.k go.k -e 'x:`<go`pkg`k' > kg.go
912 go fmt kg.go
You can’t perform that action at this time.
0 commit comments