mirror of https://git.cro.wtf/kip.git
27 lines
673 B
C
27 lines
673 B
C
#include"a.h"
|
|
|
|
typedef struct{W z,c,l;B*p;}Vec;
|
|
#define Vget(T,v,i)*(T*)vget((v),i)
|
|
#define Vfor(T,v,x,i,...)for(W i=0;i<(v).l;++i){T x=Vget(T,v,i);__VA_ARGS__;}
|
|
V vini(Vec*,W,W);
|
|
V vgrw(Vec*,W);
|
|
V*vget(Vec,W);
|
|
V*vput(Vec*);
|
|
|
|
typedef struct{W l;B*p;}S;
|
|
#define S0 (S){0,0}
|
|
#define Sl(s)(S){SZ(s)-1,(B*)(s)}
|
|
#define Sfor(s,x,i,...)W i;for(i=0;i<(s).l;++i){B x=s.p[i];__VA_ARGS__;}
|
|
B seql(S,S);
|
|
S snxt(S,B);
|
|
W fnv1a(S);
|
|
|
|
typedef struct{W z,c,l;S*k;B*v;}Ht;
|
|
#define Hget(T,h,i)(T*)hget((h),(i))
|
|
#define Hfor(h,n,v,i,...)for(W i=0;i<(h).c;++i){S n=(h).k[i];Q(k.l,B*v=(B*)((h).v+i*(h).z);__VA_ARGS__;)}
|
|
V hini(Ht*,W,W);
|
|
V hgrw(Ht*,W);
|
|
W hind(Ht,S);
|
|
V*hget(Ht,S);
|
|
V*hput(Ht*,S);
|