diff options
author | Bobby Bingham <koorogi@koorogi.info> | 2017-01-18 18:55:22 -0600 |
---|---|---|
committer | Bobby Bingham <koorogi@koorogi.info> | 2017-01-18 18:55:22 -0600 |
commit | 619c5cc4ab4bd94f9b270a9868bb5f08ffd76acb (patch) | |
tree | 5d58bf4f4cc66621f5327edb30ba593c72b4c5da /vector.c | |
parent | 17d11b2e0af9cbbe9e2c02c4d1a3d2cb4509701e (diff) |
nqasm: allow specifying labels for operands
Diffstat (limited to 'vector.c')
-rw-r--r-- | vector.c | 10 |
1 files changed, 10 insertions, 0 deletions
@@ -35,3 +35,13 @@ void *vector_append(struct vector **vp) return (char*)v + v->arrayoff + v->count++ * v->elemsize; } +void vector_sort(struct vector *v, int (*cmp)(const void *, const void *)) +{ + qsort((char*)v + v->arrayoff, v->count, v->elemsize, cmp); +} + +void *vector_search(struct vector *v, const void *key, int (*cmp)(const void *, const void *)) +{ + return bsearch(key, (char*)v + v->arrayoff, v->count, v->elemsize, cmp); +} + |