2024-03-21 09:30:47 -04:00
|
|
|
// Copyright (c) 2009-2012, Pieter Noordhuis <pcnoordhuis at gmail dot com>
|
|
|
|
// Copyright (c) 2009-2012, Salvatore Sanfilippo <antirez at gmail dot com>
|
|
|
|
// SPDX-FileCopyrightText: 2024 Redict Contributors
|
|
|
|
// SPDX-FileCopyrightText: 2024 Salvatore Sanfilippo <antirez at gmail dot com>
|
|
|
|
//
|
|
|
|
// SPDX-License-Identifier: BSD-3-Clause
|
2024-03-21 15:11:44 -04:00
|
|
|
// SPDX-License-Identifier: LGPL-3.0-only
|
2012-11-08 12:25:23 -05:00
|
|
|
|
2010-06-03 10:06:18 -04:00
|
|
|
#ifndef __INTSET_H
|
|
|
|
#define __INTSET_H
|
2010-06-11 13:22:27 -04:00
|
|
|
#include <stdint.h>
|
2010-06-03 10:06:18 -04:00
|
|
|
|
|
|
|
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);
|
2010-12-09 04:21:02 -05:00
|
|
|
intset *intsetRemove(intset *is, int64_t value, int *success);
|
2010-06-03 10:06:18 -04:00
|
|
|
uint8_t intsetFind(intset *is, int64_t value);
|
|
|
|
int64_t intsetRandom(intset *is);
|
2022-11-09 12:50:07 -05:00
|
|
|
int64_t intsetMax(intset *is);
|
|
|
|
int64_t intsetMin(intset *is);
|
2010-06-12 16:25:22 -04:00
|
|
|
uint8_t intsetGet(intset *is, uint32_t pos, int64_t *value);
|
2016-06-20 16:08:06 -04:00
|
|
|
uint32_t intsetLen(const intset *is);
|
2011-02-28 08:48:49 -05:00
|
|
|
size_t intsetBlobLen(intset *is);
|
2020-11-02 02:35:37 -05:00
|
|
|
int intsetValidateIntegrity(const unsigned char *is, size_t size, int deep);
|
2010-06-03 10:06:18 -04:00
|
|
|
|
2024-03-21 11:21:06 -04:00
|
|
|
#ifdef REDICT_TEST
|
2021-11-16 01:55:10 -05:00
|
|
|
int intsetTest(int argc, char *argv[], int flags);
|
2014-11-12 21:58:57 -05:00
|
|
|
#endif
|
|
|
|
|
2010-06-03 10:06:18 -04:00
|
|
|
#endif // __INTSET_H
|