123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140 |
- /*
- * mixed_negation.h
- *
- */
- #ifndef INCLUDE_CONTAINERS_MIXED_NEGATION_H_
- #define INCLUDE_CONTAINERS_MIXED_NEGATION_H_
- #include <roaring/containers/array.h>
- #include <roaring/containers/bitset.h>
- #include <roaring/containers/run.h>
- #ifdef __cplusplus
- extern "C" {
- namespace roaring {
- namespace internal {
- #endif
- /* Negation across the entire range of the container.
- * Compute the negation of src and write the result
- * to *dst. The complement of a
- * sufficiently sparse set will always be dense and a hence a bitmap
- * We assume that dst is pre-allocated and a valid bitset container
- * There can be no in-place version.
- */
- void array_container_negation(const array_container_t *src,
- bitset_container_t *dst);
- /* Negation across the entire range of the container
- * Compute the negation of src and write the result
- * to *dst. A true return value indicates a bitset result,
- * otherwise the result is an array container.
- * We assume that dst is not pre-allocated. In
- * case of failure, *dst will be NULL.
- */
- bool bitset_container_negation(const bitset_container_t *src,
- container_t **dst);
- /* inplace version */
- /*
- * Same as bitset_container_negation except that if the output is to
- * be a
- * bitset_container_t, then src is modified and no allocation is made.
- * If the output is to be an array_container_t, then caller is responsible
- * to free the container.
- * In all cases, the result is in *dst.
- */
- bool bitset_container_negation_inplace(bitset_container_t *src,
- container_t **dst);
- /* Negation across the entire range of container
- * Compute the negation of src and write the result
- * to *dst.
- * Return values are the *_TYPECODES as defined * in containers.h
- * We assume that dst is not pre-allocated. In
- * case of failure, *dst will be NULL.
- */
- int run_container_negation(const run_container_t *src, container_t **dst);
- /*
- * Same as run_container_negation except that if the output is to
- * be a
- * run_container_t, and has the capacity to hold the result,
- * then src is modified and no allocation is made.
- * In all cases, the result is in *dst.
- */
- int run_container_negation_inplace(run_container_t *src, container_t **dst);
- /* Negation across a range of the container.
- * Compute the negation of src and write the result
- * to *dst. Returns true if the result is a bitset container
- * and false for an array container. *dst is not preallocated.
- */
- bool array_container_negation_range(const array_container_t *src,
- const int range_start, const int range_end,
- container_t **dst);
- /* Even when the result would fit, it is unclear how to make an
- * inplace version without inefficient copying. Thus this routine
- * may be a wrapper for the non-in-place version
- */
- bool array_container_negation_range_inplace(array_container_t *src,
- const int range_start,
- const int range_end,
- container_t **dst);
- /* Negation across a range of the container
- * Compute the negation of src and write the result
- * to *dst. A true return value indicates a bitset result,
- * otherwise the result is an array container.
- * We assume that dst is not pre-allocated. In
- * case of failure, *dst will be NULL.
- */
- bool bitset_container_negation_range(const bitset_container_t *src,
- const int range_start, const int range_end,
- container_t **dst);
- /* inplace version */
- /*
- * Same as bitset_container_negation except that if the output is to
- * be a
- * bitset_container_t, then src is modified and no allocation is made.
- * If the output is to be an array_container_t, then caller is responsible
- * to free the container.
- * In all cases, the result is in *dst.
- */
- bool bitset_container_negation_range_inplace(bitset_container_t *src,
- const int range_start,
- const int range_end,
- container_t **dst);
- /* Negation across a range of container
- * Compute the negation of src and write the result
- * to *dst. Return values are the *_TYPECODES as defined * in containers.h
- * We assume that dst is not pre-allocated. In
- * case of failure, *dst will be NULL.
- */
- int run_container_negation_range(const run_container_t *src,
- const int range_start, const int range_end,
- container_t **dst);
- /*
- * Same as run_container_negation except that if the output is to
- * be a
- * run_container_t, and has the capacity to hold the result,
- * then src is modified and no allocation is made.
- * In all cases, the result is in *dst.
- */
- int run_container_negation_range_inplace(run_container_t *src,
- const int range_start,
- const int range_end,
- container_t **dst);
- #ifdef __cplusplus
- }
- }
- } // extern "C" { namespace roaring { namespace internal {
- #endif
- #endif /* INCLUDE_CONTAINERS_MIXED_NEGATION_H_ */
|