This commit is contained in:
Rongsong Shen 2026-01-15 17:56:53 +08:00
parent ecf1916d78
commit 06209930f9
13 changed files with 573 additions and 241 deletions

39
src/include/xvec.h Normal file
View file

@ -0,0 +1,39 @@
#if !defined(_XVEC_H_)
#define _XVEC_H_ 1
#include <stddef.h>
#include <stdint.h>
#include <stdlib.h>
typedef enum {
XVEC_ADD_INT = 0,
XVEC_SUB_INT,
XVEC_ADD_FLOAT,
XVEC_SUB_FLOAT
} xvec_op_t;
typedef struct {
int count;
int elsize;
void* data;
} xvec_t;
typedef struct {
int count;
xvec_t idxs;
xvec_t vals;
} xvec_idval_t;
extern int xvec_init(xvec_t*, int, int);
extern void xvec_fini(xvec_t*);
extern int xvec_zero(xvec_t*);
extern int xvec_resize(xvec_t*, int);
extern int xvec_op(xvec_t*, xvec_t*, xvec_op_t);
extern int xvec_dup(xvec_t**, xvec_t*);
extern int xvec_put(xvec_t*, int, void*);
extern int xvec_get(xvec_t*, int, void*);
extern int xvec_idval_init(xvec_idval_t*, int);
extern void xvec_idval_fini(xvec_idval_t*);
extern int xvec_idval_store(xvec_idval_t*, int, float);
#endif