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+ void reg (int64_t id , int64_t name , int32_t arity ){
2+ int64_t l = ti (14 ,(uint32_t )l2 (id , Ku (name )));
3+ SetI32 ((int32_t )l - 12 ,arity );
4+ dx (Asn (sc (Ku (name )),l ));
5+ }
6+ void libs (void ){ //encode strings with: https://play.golang.org/p/4ethx6OEVCR
7+ reg (0 ,846033518ull ,1 ); //nrm2
8+ //reg(1,...);
9+ //reg(2,...);
10+ }
11+ int64_t cnative (int64_t x , int64_t y ){
12+ switch (x ){ //switch registered function id
13+ case 0 : printf ("todo call blas nrm2\n" ); return y ; break ;
14+ default : return y ;
15+ }}
16+
Original file line number Diff line number Diff line change 1+ #define NATIVE 1
2+ void libs (void );
3+ int64_t cnative (int64_t ,int64_t );
Original file line number Diff line number Diff line change 1+ # extend k.c with some c-libraries using the native function type
2+ # blas lapack fftw lp_solve ..
3+
4+ set -e
5+ set -x
6+ CC=cc
7+ if [ "$1" = "get" ];then
8+ wget -Okc.orig https://github.com/ktye/i/releases/download/latest/k.c
9+ fi
10+
11+ sed -e 's/math.h>$/math.h>\n#include"l.h"/' -e 's/kinit()/kinit();libs()/' kc.orig>k.c
12+ cat l.c >>k.c
13+
14+ $CC -O3 -march=native -ok+ k.c -lm
You can’t perform that action at this time.
0 commit comments