// Copyright (c) 2009-2012, Pieter Noordhuis // Copyright (c) 2009-2012, Salvatore Sanfilippo // SPDX-FileCopyrightText: 2024 Redict Contributors // SPDX-FileCopyrightText: 2024 Salvatore Sanfilippo // // SPDX-License-Identifier: BSD-3-Clause // SPDX-License-Identifier: LGPL-3.0-only #ifndef __INTSET_H #define __INTSET_H #include typedef struct intset { uint32_t encoding; uint32_t length; int8_t contents[]; } intset; intset *intsetNew(void); intset *intsetAdd(intset *is, int64_t value, uint8_t *success); intset *intsetRemove(intset *is, int64_t value, int *success); uint8_t intsetFind(intset *is, int64_t value); int64_t intsetRandom(intset *is); int64_t intsetMax(intset *is); int64_t intsetMin(intset *is); uint8_t intsetGet(intset *is, uint32_t pos, int64_t *value); uint32_t intsetLen(const intset *is); size_t intsetBlobLen(intset *is); int intsetValidateIntegrity(const unsigned char *is, size_t size, int deep); #ifdef REDICT_TEST int intsetTest(int argc, char *argv[], int flags); #endif #endif // __INTSET_H