Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

file 31 lines (25 sloc) 0.896 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
#ifndef __PSET_H
#define __PSET_H
#include <stdint.h>

typedef struct psetType {
    uint8_t size[2];
    uint8_t psize; /* size of one pair */
    int (*cmp[2])(const void*, const void*);
} psetType;

typedef struct {
    psetType *type;
    uint32_t length;
    int8_t contents[];
} pset;

#define PSET_GET(_ps,_pos,_w) ((_ps)->contents+(_pos)*(_ps)->type->psize+(_w)*(_ps)->type->size[0])

pset *psetNew(psetType *type);
pset *psetInsert(pset *ps, void *v0, void *v1, uint8_t *success);
int psetFind(pset *ps, void *v0);

// intset *intsetNew(void);
// intset *intsetAdd(intset *is, int64_t value, uint8_t *success);
// intset *intsetRemove(intset *is, int64_t value, uint8_t *success);
// uint8_t intsetFind(intset *is, int64_t value);
// int64_t intsetRandom(intset *is);
// uint8_t intsetGet(intset *is, uint32_t pos, int64_t *value);
// uint32_t intsetLen(intset *is);

#endif // __PSET_H
Something went wrong with that request. Please try again.