Class RoaringBitmap32

Roaring bitmap that supports 32 bit unsigned integers.

Export

RoaringBitmap32

Implements

Author

Salvatore Previti

Hierarchy (view full)

Constructors

Properties

Accessors

Methods

Constructors

  • Creates an instance of RoaringBitmap32 with a given initial capacity.

    Parameters

    • Optional capacity: number

      The initial capacity of the bitmap.

    Returns RoaringBitmap32

    Memberof

    RoaringBitmap32

  • Creates an instance of RoaringBitmap32, or copies the given bitmap.

    Is faster to pass a Uint32Array instance instead of an array or an iterable.

    Is even faster if the given argument is a RoaringBitmap32 (performs a fast copy).

    Parameters

    • Optional values: Iterable<number>

    Returns RoaringBitmap32

    Memberof

    RoaringBitmap32

  • Creates a new frozen readonly view of the given bitmap. The bitmap will contain the same data, and if the first bitmap is modified the second one will be modified too. The created bitmap is frozen, so it is not possible to modify it.

    Parameters

    Returns RoaringBitmap32

    Memberof

    RoaringBitmap32Iterator

Properties

DeserializationFormat: typeof DeserializationFormat
FileDeserializationFormat: typeof FileDeserializationFormat
FileSerializationFormat: typeof FileSerializationFormat
FrozenViewFormat: typeof FrozenViewFormat
SerializationFormat: typeof SerializationFormat
[toStringTag]: "Set"

Returns always "RoaringBitmap32".

To have a standard string representation of the content as a string, call contentToString() instead.

Returns

"Set"

Memberof

RoaringBitmap32

DeserializationFormat: typeof DeserializationFormat
FileDeserializationFormat: typeof FileDeserializationFormat
FileSerializationFormat: typeof FileSerializationFormat
FrozenViewFormat: typeof FrozenViewFormat
SerializationFormat: typeof SerializationFormat
default: typeof RoaringBitmap32

Accessors

  • get CRoaringVersion(): string
  • Property: The version of the CRoaring libary as a string. Example: "0.9.2"

    Returns string

    Export

    Constant

    Memberof

    RoaringBitmap32

  • get PackageVersion(): string
  • Property: The version of the roaring npm package as a string. Example: "1.2.0"

    Returns string

    Export

    Constant

    Memberof

    RoaringBitmap32

  • get isEmpty(): boolean
  • Property. True if the bitmap is empty.

    Returns boolean

    Memberof

    ReadonlyRoaringBitmap32

  • get isFrozen(): boolean
  • Property. True if the bitmap is read-only. A read-only bitmap cannot be modified, every operation will throw an error. You can freeze a bitmap using the freeze() method. A bitmap cannot be unfrozen.

    Returns boolean

    Memberof

    ReadonlyRoaringBitmap32

  • get size(): number
  • Property. Gets the number of items in the set (cardinality).

    Returns number

    Memberof

    ReadonlyRoaringBitmap32

  • get CRoaringVersion(): string
  • Property: The version of the CRoaring libary as a string. Example: "0.4.0"

    Returns string

    Export

    Constant

  • get PackageVersion(): string
  • Property: The version of the roaring npm package as a string. Example: "1.2.0"

    Returns string

    Export

    Constant

Methods

  • Adds the given value (or values) to the set.

    Parameters

    • Rest ...values: (undefined | null | string | number)[]

      The values to add.

    Returns this

    This RoaringBitmap32 instance.

    Memberof

    RoaringBitmap32

  • Adds multiple values to the set.

    Faster than calling add() multiple times.

    It is faster to insert sorted or partially sorted values.

    Is faster to use Uint32Array instead of arrays or iterables.

    Is optimized if the argument is an instance of RoaringBitmap32 (it performs an OR union).

    Parameters

    • values: ArrayLike<number> | Iterable<number>

      An iterable of values to insert.

    Returns this

    This RoaringBitmap32 instance.

    Memberof

    RoaringBitmap32

  • Adds all the values in the interval: [rangeStart, rangeEnd).

    First element is included, last element is excluded. The number of added values is rangeEnd - rangeStart.

    Areas outside the range are passed through unchanged.

    Parameters

    • rangeStart: undefined | number

      The start index. Trimmed to 0.

    • Optional rangeEnd: number

      The end index. Trimmed to 4294967296.

    Returns this

    This RoaringBitmap32 instance.

    Memberof

    RoaringBitmap32

  • Computes the size of the intersection between two bitmaps (the number of values in common).

    Returns -1 if the given argument is not a ReadonlyRoaringBitmap32 instance.

    Parameters

    Returns number

    The number of elements in common.

    Memberof

    ReadonlyRoaringBitmap32

  • Performs the intersection (and) between the current bitmap and the provided bitmap, writing the result in the current bitmap.

    Is faster to use Uint32Array instead of arrays or iterables.

    This function is optimized if the argument is an instance of RoaringBitmap32.

    The provided bitmap is not modified.

    Parameters

    • values: Iterable<number>

      A RoaringBitmap32 instance or an iterable of unsigned 32 bit integers.

    Returns this

    This RoaringBitmap32 instance.

    Memberof

    RoaringBitmap32

  • Computes the size of the difference (andnot) between two bitmaps.

    Returns -1 if the given argument is not a ReadonlyRoaringBitmap32 instance.

    Parameters

    Returns number

    The number of elements in common.

    Memberof

    ReadonlyRoaringBitmap32

  • Performs a AND NOT operation in place ("this = this AND NOT values"), same as removeMany.

    Is faster to use Uint32Array instead of arrays or iterables.

    This function is optimized if the argument is an instance of RoaringBitmap32.

    Parameters

    • values: Iterable<number>

      A RoaringBitmap32 instance or an iterable of unsigned 32 bit integers.

    Returns this

    This RoaringBitmap32 instance.

    Memberof

    RoaringBitmap32

  • A readonly view on this bitmap. It returns always the same instance. Can return this if this bitmap is fully hard frozen. The bitmap will contain the same data, and if the first bitmap is modified the readonlyView bitmap one will be modified too. The readonlyView bitmap is readonly, so it is not possible to modify it.

    Returns ReadonlyRoaringBitmap32

  • The at() method takes an integer value and returns the item at that index, allowing for positive and negative integers. Negative integers count back from the last item in the set.

    Parameters

    • index: number

      Zero-based index of the array element to be returned, converted to an integer. Negative index counts back from the end of the array — if index < 0, index + array.length is accessed.

    Returns undefined | number

    The element in the set matching the given index. Always returns undefined if index < -array.length or index >= array.length without attempting to access the corresponding property.

    Memberof

    RoaringBitmap32

  • Removes all values from the set.

    It frees resources, you can use clear() to free some memory before the garbage collector disposes this instance.

    Returns boolean

    Memberof

    RoaringBitmap32

  • Returns a standard string representation of the content of this ReadonlyRoaringBitmap32 instance. It may return a very long string.

    Default max length is 32000 characters, everything after maxLength is truncated (ellipsis added).

    Parameters

    • Optional maxLength: number

      Approximate maximum length of the string. Default is 32000. Ellipsis will be added if the string is longer.

    Returns string

    A string in the format "[1,2,3...]"

    Memberof

    ReadonlyRoaringBitmap32

  • Overwrite the content of this bitmap copying it from an Iterable or another RoaringBitmap32.

    Is faster to pass a Uint32Array instance instead of an array or an iterable. Is even faster if a RoaringBitmap32 instance is used (it performs a simple copy).

    Parameters

    • values: undefined | null | Iterable<number>

      The new values or a RoaringBitmap32 instance.

    Returns this

    This RoaringBitmap32 instance.

    Memberof

    RoaringBitmap32

  • Removes a value (or multiple values) from the set.

    Returns true if the value (or at least one value) was removed during this call, false if not.

    Parameters

    • Rest ...values: (undefined | null | string | number)[]

      The unsigned 32 bit values to remove.

    Returns boolean

    True if the value was removed during this call, false if not.

    Memberof

    RoaringBitmap32

  • Deserializes the bitmap from an Uint8Array or a Buffer.

    Setting the portable flag to false enable a custom format that can save space compared to the portable format (e.g., for very sparse bitmaps). The portable version is meant to be compatible with Java and Go versions.

    Parameters

    • serialized: ArrayBuffer | SharedArrayBuffer | Int8Array | Uint8Array | Uint8ClampedArray

      An Uint8Array or a node Buffer that contains the serialized data.

    • format: DeserializationFormatType

      The format of the serialized data. true means "portable". false means "croaring".

    Returns this

    This ReadonlyRoaringBitmap32 instance.

    Memberof

    ReadonlyRoaringBitmap32

  • Gets a new iterator able to iterate all value pairs [value, value] in the set in ascending order. This is just for compatibility with the Set interface.

    WARNING: Is not allowed to change the bitmap while iterating. Undefined behaviour. The iterator may throw exception if the bitmap is changed during the iteration.

    Same as Symbol.iterator

    Returns IterableIterator<[number, number]>

    A new iterator

    Memberof

    ReadonlyRoaringBitmap32

  • Behaves like array.every. The every() method tests whether all elements in the set pass the test implemented by the provided function. It returns a Boolean value.

    WARNING: this can potentially iterate a large set of to 4 billion elements.

    WARNING: Is not allowed to change the bitmap while iterating. Undefined behaviour.

    Parameters

    • callbackfn: ((value, index, set) => boolean)
        • (value, index, set): boolean
        • Parameters

          • value: number
          • index: number
          • set: this

          Returns boolean

    • Optional thisArg: unknown

    Returns boolean

  • It behaves like array.filter. WARNING: The returned array may be very big, up to 4 billion elements. WARNING: Is not allowed to change the bitmap while iterating. Undefined behaviour.

    Parameters

    • predicate: ((value, index, set) => boolean)
        • (value, index, set): boolean
        • Parameters

          • value: number
          • index: number
          • set: this

          Returns boolean

    • Optional thisArg: unknown

      An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.

    • Optional output: number[]

    Returns number[]

    A new array containing all elements of the array that satisfy the given predicate.

  • Behaves like array.find. The find() method returns the value of the first element in the set that satisfies the provided testing function. Otherwise undefined is returned. WARNING: this can potentially iterate a large set of to 4 billion elements. WARNING: Is not allowed to change the bitmap while iterating. Undefined behaviour.

    Parameters

    • predicate: ((value, index, set) => boolean)

      find calls predicate once for each element of the set, in ascending order, until it finds one where predicate returns true. If such an element is found, find immediately returns that element value. Otherwise, find returns undefined.

        • (value, index, set): boolean
        • Parameters

          • value: number
          • index: number
          • set: this

          Returns boolean

    • Optional thisArg: unknown

      If provided, it will be used as the this value for each invocation of predicate. If it is not provided, undefined is used instead.

    Returns undefined | number

    The value of the first element in the set that satisfies the provided testing function. Otherwise undefined is returned.

  • Behaves like array.findIndex. The findIndex() method returns the index of the first element in the set that satisfies the provided testing function. Otherwise, it returns -1, indicating that no element passed the test. WARNING: this can potentially iterate a large set of to 4 billion elements. WARNING: Is not allowed to change the bitmap while iterating. Undefined behaviour.

    Parameters

    • predicate: ((value, index, set) => boolean)

      find calls predicate once for each element of the set, in ascending order, until it finds one where predicate returns true. If such an element is found, findIndex immediately returns that element index. Otherwise, findIndex returns -1.

        • (value, index, set): boolean
        • Parameters

          • value: number
          • index: number
          • set: this

          Returns boolean

    • Optional thisArg: unknown

      If provided, it will be used as the this value for each invocation of predicate. If it is not provided, undefined is used instead.

    Returns number

    The index of the first element in the set that satisfies the provided testing function. Otherwise, it returns -1, indicating that no element passed the test.

  • Negates (in place) the roaring bitmap within a specified interval: [rangeStart, rangeEnd).

    First element is included, last element is excluded. The number of negated values is rangeEnd - rangeStart.

    Areas outside the range are passed through unchanged.

    Parameters

    • rangeStart: undefined | number

      The start index. Trimmed to 0.

    • Optional rangeEnd: number

      The end index. Trimmed to 4294967296.

    Returns this

    This RoaringBitmap32 instance.

    Memberof

    RoaringBitmap32

  • Executes a function for each value in the set, in ascending order. The callback has 3 arguments, the value, the value and this (this set). This is to match the Set interface.

    WARNING: Is not allowed to change the bitmap while iterating. Undefined behaviour.

    WARNING: the second parameter of the callback is not the index, but the value itself, the same as the first argument. This is required to match the Set interface.

    Type Parameters

    • This = unknown

    Parameters

    • callbackfn: ((this, value, value2, set) => void)
        • (this, value, value2, set): void
        • Parameters

          • this: This
          • value: number
          • value2: number
          • set: this

          Returns void

    • Optional thisArg: This

    Returns this

  • Makes this roaring bitmap readonly. Sets isFrozen to true. This is a no-op if isFrozen is already true. Every attempt to modify the bitmap will throw an exception. A bitmap cannot be unfrozen.

    Returns this

    This instance.

    Memberof

    RoaringBitmap32

  • How many bytes are required to serialize this bitmap.

    Setting the format flag to false enable a custom format that can save space compared to the portable format (e.g., for very sparse bitmaps). The portable version is meant to be compatible with Java and Go versions.

    Parameters

    • format: SerializationFormatType

      One of the SerializationFormat enum values, or a boolean value: if false, optimized C/C++ format is used. If true, Java and Go portable format is used.

    Returns number

    How many bytes are required to serialize this bitmap.

    Memberof

    ReadonlyRoaringBitmap32

  • Checks wether the given value exists in the set.

    Parameters

    • value: unknown

      A 32 bit unsigned integer to search.

    Returns boolean

    True if the set contains the given value, false if not.

    Memberof

    ReadonlyRoaringBitmap32

  • Check whether a range of values from rangeStart (included) to rangeEnd (excluded) is present

    Parameters

    • rangeStart: undefined | number

      The start index (inclusive).

    • Optional rangeEnd: number

      The end index (exclusive).

    Returns boolean

    True if the bitmap contains the whole range of values from rangeStart (included) to rangeEnd (excluded), false if not.

    Memberof

    ReadonlyRoaringBitmap32

  • Checks wether the given value exists in the set. Is the same as this.has(value).

    Parameters

    • value: unknown

      A 32 bit unsigned integer to search.

    Returns boolean

    True if the set contains the given value, false if not.

    Memberof

    ReadonlyRoaringBitmap32

  • Returns the index of value in the set, index start from 0. If the set doesn't contain value, this function will return -1. The difference with rank function is that this function will return -1 when value isn't in the set, but the rank function will return a non-negative number.

    Parameters

    • value: unknown

      A 32 bit unsigned integer to search.

    • Optional fromIndex: number

      The index to start the search at, defaults to 0. It does not have performance difference, is just for compatibility with array.indexOf.

    Returns number

    True if the set contains the given value, false if not.

    Memberof

    ReadonlyRoaringBitmap32

  • Check whether the two bitmaps intersect.

    Returns true if there is at least one item in common, false if not.

    Returns false also if the given argument is not a ReadonlyRoaringBitmap32 instance.

    Parameters

    Returns boolean

    True if the two set intersects, false if not.

    Memberof

    ReadonlyRoaringBitmap32

  • Check whether a bitmap and a closed range intersect.

    Parameters

    • rangeStart: undefined | number

      The start of the range.

    • Optional rangeEnd: number

      The end of the range.

    Returns boolean

    True if the bitmap and the range intersects, false if not.

  • Checks wether this set is equal to another set.

    Returns false also if the given argument is not a ReadonlyRoaringBitmap32 instance.

    Parameters

    Returns boolean

    True if the two sets contains the same elements, false if not.

    Memberof

    ReadonlyRoaringBitmap32

  • Checks wether this set is a strict subset of the given set.

    Returns false if the sets are the same.

    Returns false also if the given argument is not a ReadonlyRoaringBitmap32 instance.

    Parameters

    Returns boolean

    True if this set is a strict subset of the given ReadonlyRoaringBitmap32. False if not.

    Memberof

    ReadonlyRoaringBitmap32

  • Checks wether this set is a subset or the same as the given set.

    Returns false also if the given argument is not a ReadonlyRoaringBitmap32 instance.

    Parameters

    Returns boolean

    True if this set is a subset of the given ReadonlyRoaringBitmap32. False if not.

    Memberof

    ReadonlyRoaringBitmap32

  • Returns a standard string representation of the content of this ReadonlyRoaringBitmap32 instance.

    WARNING: this can potentially iterate a large set of to 4 billion elements.

    Parameters

    • Optional separator: string

      The separator to use between elements. Default is ",".

    Returns string

    A string in the format "123..."

    Memberof

    ReadonlyRoaringBitmap32

  • Returns the index of value in the set, index start from 0. If the set doesn't contain value, this function will return -1. The difference with rank function is that this function will return -1 when value isn't in the set, but the rank function will return a non-negative number. If fromIndex is not specified, is the same as this.indexOf(value). It behaves like array.lastIndexOf, but it doesn't have performance difference, is just for compatibility with array.lastIndexOf.

    Parameters

    • value: unknown

      A 32 bit unsigned integer to search.

    • Optional fromIndex: number

      The index to start the search at, defaults to 0. It does not have performance difference, is just for compatibility with array.indexOf.

    Returns number

    True if the set contains the given value, false if not.

    Memberof

    ReadonlyRoaringBitmap32

  • It behaves like array.map. WARNING: The returned array may be very big, up to 4 billion elements. WARNING: Is not allowed to change the bitmap while iterating. Undefined behaviour.

    Type Parameters

    • U
    • This = unknown

    Parameters

    • callbackfn: ((this, value, index, set) => U)

      A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array.

        • (this, value, index, set): U
        • Parameters

          • this: This
          • value: number
          • index: number
          • set: this

          Returns U

    • Optional thisArg: This

      An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.

    • Optional output: U[]

    Returns U[]

    An array containing the results of calling the callbackfn function on each element in the set.

  • Gets the minimum value in the set.

    Returns number

    The minimum value in the set or 0xFFFFFFFF if empty.

    Memberof

    ReadonlyRoaringBitmap32

  • Computes the size of the union between two bitmaps.

    Returns -1 if the given argument is not a ReadonlyRoaringBitmap32 instance.

    Parameters

    Returns number

    The number of elements in common.

    Memberof

    ReadonlyRoaringBitmap32

  • Performs an union in place ("this = this OR values"), same as addMany.

    Is faster to use Uint32Array instead of arrays or iterables.

    This function is optimized if the argument is an instance of RoaringBitmap32.

    Parameters

    • values: Iterable<number>

      A RoaringBitmap32 instance or an iterable of unsigned 32 bit integers.

    Returns this

    This RoaringBitmap32 instance.

    Memberof

    RoaringBitmap32

  • The pop() method removes the last element from a roaring bitmap and returns that element. This method changes the size of the bitmap

    Returns undefined | number

    The last element in the bitmap, or undefined if the bitmap is empty.

    Memberof

    RoaringBitmap32

  • Gets the cardinality (number of elements) between rangeStart (included) to rangeEnd (excluded) of the bitmap. Returns 0 if range is invalid or if no element was found in the given range.

    Parameters

    • rangeStart: undefined | number

      The start index (inclusive).

    • Optional rangeEnd: number

      The end index (exclusive).

    Returns number

    The number of elements between rangeStart (included) to rangeEnd (excluded).

  • toUint32Array array with pagination

    Parameters

    • output: ArrayBuffer | SharedArrayBuffer | Int32Array | Uint32Array
    • offset: number
    • Optional limit: number

    Returns Uint32Array

    A new Uint32Array instance containing paginated items in the set in order.

    Memberof

    ReadonlyRoaringBitmap32

  • toUint32Array array with pagination

    Parameters

    • minimumValue: number
    • maximumValue: number

    Returns Uint32Array

    A new Uint32Array instance containing paginated items in the set in order.

    Memberof

    ReadonlyRoaringBitmap32

  • toUint32Array array with pagination

    Parameters

    • minimumValue: number
    • maximumValue: number
    • output: ArrayBuffer | SharedArrayBuffer | Int32Array | Uint32Array

      The output array.

    Returns Uint32Array

    The output array. Limited to the resulting size.

    Memberof

    ReadonlyRoaringBitmap32

  • toUint32Array array with pagination

    Parameters

    • minimumValue: number
    • output: ArrayBuffer | SharedArrayBuffer | Int32Array | Uint32Array

      The output array.

    Returns Uint32Array

    The output array. Limited to the resulting size.

    Memberof

    ReadonlyRoaringBitmap32

  • Same as toUint32Array

    Parameters

    • output: ArrayBuffer | SharedArrayBuffer | Int32Array | Uint32Array

      The output array.

    Returns Uint32Array

    The output array. Limited to the resulting size.

    Memberof

    ReadonlyRoaringBitmap32

  • Returns the number of values in the set that are smaller or equal to the given value.

    Parameters

    • maxValue: number

      The maximum value

    Returns number

    Returns the number of values in the set that are smaller or equal to the given value.

    Memberof

    ReadonlyRoaringBitmap32

  • Behaves like array.reduce. The reduce() method applies a function against an accumulator and each value of the set (from left-to-right) to reduce it to a single value.

    WARNING: this can potentially iterate a large set of to 4 billion elements.

    WARNING: Is not allowed to change the bitmap while iterating. Undefined behaviour.

    Parameters

    • callbackfn: ((previousValue, currentValue, currentIndex, set) => number)

      A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the set.

        • (previousValue, currentValue, currentIndex, set): number
        • Parameters

          • previousValue: number
          • currentValue: number
          • currentIndex: number
          • set: this

          Returns number

    Returns number

    The value that results from the reduction.

  • Parameters

    • callbackfn: ((previousValue, currentValue, currentIndex, set) => number)
        • (previousValue, currentValue, currentIndex, set): number
        • Parameters

          • previousValue: number
          • currentValue: number
          • currentIndex: number
          • set: this

          Returns number

    • initialValue: undefined | number

    Returns number

  • Type Parameters

    • U

    Parameters

    • callbackfn: ((previousValue, currentValue, currentIndex, set) => U)
        • (previousValue, currentValue, currentIndex, set): U
        • Parameters

          • previousValue: U
          • currentValue: number
          • currentIndex: number
          • set: this

          Returns U

    • initialValue: U

    Returns U

  • Behaves like array.reduceRight. The reduceRight() method applies a function against an accumulator and each value of the set (from right-to-left) to reduce it to a single value. WARNING: this can potentially iterate a large set of to 4 billion elements. WARNING: Is not allowed to change the bitmap while iterating. Undefined behaviour.

    Parameters

    • callbackfn: ((previousValue, currentValue, currentIndex, set) => number)

      A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the set.

        • (previousValue, currentValue, currentIndex, set): number
        • Parameters

          • previousValue: number
          • currentValue: number
          • currentIndex: number
          • set: this

          Returns number

    Returns number

    The value that results from the reduction.

  • Parameters

    • callbackfn: ((previousValue, currentValue, currentIndex, set) => number)
        • (previousValue, currentValue, currentIndex, set): number
        • Parameters

          • previousValue: number
          • currentValue: number
          • currentIndex: number
          • set: this

          Returns number

    • initialValue: undefined | number

    Returns number

  • Type Parameters

    • U

    Parameters

    • callbackfn: ((previousValue, currentValue, currentIndex, set) => U)
        • (previousValue, currentValue, currentIndex, set): U
        • Parameters

          • previousValue: U
          • currentValue: number
          • currentIndex: number
          • set: this

          Returns U

    • initialValue: U

    Returns U

  • Removes a value (or multiple values) from the set.

    Returns true if the value (or at least one value) was removed during this call, false if not.

    Parameters

    • Rest ...values: (undefined | null | string | number)[]

      The unsigned 32 bit values to remove.

    Returns boolean

    True if the value was removed during this call, false if not.

    Memberof

    RoaringBitmap32

  • Removes multiple values from the set.

    Faster than calling remove() multiple times.

    Is faster to use Uint32Array instead of arrays or iterables.

    This function is optimized if the argument is an instance of RoaringBitmap32 (it performs an AND NOT operation).

    Parameters

    • values: Iterable<number>

      An iterable of values to remove.

    Returns this

    This RoaringBitmap32 instance.

    Memberof

    RoaringBitmap32

  • Removes all the values in the interval: [rangeStart, rangeEnd).

    First element is included, last element is excluded. The number of renived values is rangeEnd - rangeStart.

    Areas outside the range are passed through unchanged.

    Parameters

    • rangeStart: undefined | number

      The start index. Trimmed to 0.

    • Optional rangeEnd: number

      The end index. Trimmed to 4294967296.

    Returns this

    This RoaringBitmap32 instance.

    Memberof

    RoaringBitmap32

  • Remove run-length encoding even when it is more space efficient.

    Return whether a change was applied.

    Returns boolean

    True if a change was applied, false if not.

    Memberof

    RoaringBitmap32

  • Convert array and bitmap containers to run containers when it is more efficient; also convert from run containers when more space efficient.

    Returns true if the bitmap has at least one run container.

    Additional savings might be possible by calling shrinkToFit().

    Returns boolean

    True if the bitmap has at least one run container.

    Memberof

    RoaringBitmap32

  • If the size of the roaring bitmap is strictly greater than rank, then this function returns the element of given rank.

    Otherwise, it returns undefined.

    Parameters

    • rank: number

      The rank, an unsigned 32 bit integer.

    Returns undefined | number

    The element of the given rank or undefined if not found.

    Memberof

    ReadonlyRoaringBitmap32

  • Serializes the bitmap into a new Buffer.

    Setting the formatg to false enable a custom format that can save space compared to the portable format (e.g., for very sparse bitmaps). The portable version is meant to be compatible with Java and Go versions.

    Parameters

    • format: SerializationFormatType

      One of the SerializationFormat enum values, or a boolean value: if false, optimized C/C++ format is used. If true, Java and Go portable format is used.

    • Optional _output: undefined

    Returns Buffer

    A new node Buffer that contains the serialized bitmap.

    Memberof

    ReadonlyRoaringBitmap32

  • Serializes the bitmap into the given Buffer, starting to write at the given outputStartIndex position. The operation will fail with an error if the buffer is smaller than what getSerializationSizeInBytes(format) returns.

    Setting the format to false enable a custom format that can save space compared to the portable format (e.g., for very sparse bitmaps). The portable version is meant to be compatible with Java and Go versions.

    Parameters

    • format: SerializationFormatType

      If false, optimized C/C++ format is used. If true, Java and Go portable format is used.

    • output: ArrayBuffer | SharedArrayBuffer | Int8Array | Uint8Array | Uint8ClampedArray

      The node Buffer where to write the serialized data.

    Returns Buffer

    The output Buffer. If the input buffer was exactly of the same size. Otherwise, a new buffer backed by the same storage is returned, with the correct offset and length.

    Memberof

    ReadonlyRoaringBitmap32

  • Serializes the bitmap into the given Buffer, starting to write at position 0. The operation will fail with an error if the buffer is smaller than what getSerializationSizeInBytes(format) returns.

    Setting the portable flag to false enable a custom format that can save space compared to the portable format (e.g., for very sparse bitmaps). The portable version is meant to be compatible with Java and Go versions.

    Parameters

    • output: ArrayBuffer | SharedArrayBuffer | Int8Array | Uint8Array | Uint8ClampedArray

      The node Buffer where to write the serialized data.

    • format: SerializationFormatType

    Returns Buffer

    The output Buffer. If the input buffer was exactly of the same size. Otherwise, a new buffer backed by the same storage is returned, with the correct offset and length.

    Memberof

    ReadonlyRoaringBitmap32

  • Serializes the bitmap into a new Buffer. The bitmap will be temporarily frozen until the operation completes.

    Setting the portable flag to false enable a custom format that can save space compared to the portable format (e.g., for very sparse bitmaps). The portable version is meant to be compatible with Java and Go versions.

    Parameters

    • format: SerializationFormatType

      One of the SerializationFormat enum values, or a boolean value: if false, optimized C/C++ format is used. If true, Java and Go portable format is used.

    • Optional _output: undefined

    Returns Promise<Buffer>

    A new node Buffer that contains the serialized bitmap.

    Memberof

    ReadonlyRoaringBitmap32

  • Serializes the bitmap into the given Buffer, starting to write at the given outputStartIndex position. The bitmap will be temporarily frozen until the operation completes. The operation will fail with an error if the buffer is smaller than what getSerializationSizeInBytes(format) returns.

    Setting the portable flag to false enable a custom format that can save space compared to the portable format (e.g., for very sparse bitmaps). The portable version is meant to be compatible with Java and Go versions.

    Parameters

    • format: SerializationFormatType

      If false, optimized C/C++ format is used. If true, Java and Go portable format is used.

    • output: ArrayBuffer | SharedArrayBuffer | Int8Array | Uint8Array | Uint8ClampedArray

      The node Buffer where to write the serialized data.

    Returns Promise<Buffer>

    The output Buffer. If the input buffer was exactly of the same size, the same buffer is returned. Otherwise, a new buffer backed by the same storage is returned, with the correct offset and length.

    Memberof

    ReadonlyRoaringBitmap32

  • Serializes the bitmap into the given Buffer, starting to write at position 0. The bitmap will be temporarily frozen until the operation completes. The operation will fail with an error if the buffer is smaller than what getSerializationSizeInBytes(format) returns.

    Setting the portable flag to false enable a custom format that can save space compared to the portable format (e.g., for very sparse bitmaps). The portable version is meant to be compatible with Java and Go versions.

    Parameters

    • output: ArrayBuffer | SharedArrayBuffer | Int8Array | Uint8Array | Uint8ClampedArray

      The node Buffer where to write the serialized data.

    • format: SerializationFormatType

    Returns Promise<Buffer>

    The output Buffer. If the input buffer was exactly of the same size, the same buffer is returned. Otherwise, a new buffer backed by the same storage is returned, with the correct offset and length.

    Memberof

    ReadonlyRoaringBitmap32

  • Serializes the bitmap into a file, asynchronously. The bitmap will be temporarily frozen until the operation completes.

    This is faster, everything runs in its own thread and it consumes less memory than serializing to a Buffer and then to write to a file, internally it uses memory mapped files and skip all the JS overhead.

    Parameters

    • filePath: string
    • format: FileSerializationFormatType

      One of the SerializationFormat enum values, or a boolean value: if false, optimized C/C++ format is used. If true, Java and Go portable format is used.

    Returns Promise<void>

    Memberof

    ReadonlyRoaringBitmap32

  • The shift() method removes the first element from a roaring bitmap and returns that element. This method changes the size of the bitmap

    Returns undefined | number

    The first element in the bitmap, or undefined if the bitmap is empty.

    Memberof

    RoaringBitmap32

  • If needed, reallocate memory to shrink the memory usage.

    Returns the number of bytes saved.

    Returns number

    The number of bytes saved.

    Memberof

    RoaringBitmap32

  • Behaves like array.some. The some() method tests whether at least one element in the set passes the test implemented by the provided function. It returns true if, in the set, it finds an element for which the provided function returns true; otherwise it returns false.

    WARNING: this can potentially iterate a large set of to 4 billion elements.

    WARNING: Is not allowed to change the bitmap while iterating. Undefined behaviour.

    Parameters

    • callbackfn: ((value, index, set) => boolean)
        • (value, index, set): boolean
        • Parameters

          • value: number
          • index: number
          • set: this

          Returns boolean

    • Optional thisArg: unknown

    Returns boolean

  • Creates a new plain JS array and fills it with all the values in the bitmap.

    The returned array may be very big, use this function only when you know what you are doing.

    Parameters

    • Optional maxLength: number

      The maximum number of elements to return.

    Returns number[]

    A new plain JS array that contains all the items in the set in order.

    Memberof

    ReadonlyRoaringBitmap32

  • Append all the values in this bitmap to the given plain JS array.

    The resulting array may be very big, use this function only when you know what you are doing.

    Type Parameters

    • TOutput extends number[]

      The type of the output array.

    Parameters

    • output: TOutput

      The output array.

    • Optional maxLength: number

      The maximum number of elements to return.

    • Optional offset: number

    Returns TOutput

    The output array.

    Memberof

    ReadonlyRoaringBitmap32

  • Returns a plain JS array with all the values in the bitmap.

    Used by JSON.stringify to serialize this bitmap as an array.

    Returns number[]

    A new plain JS array that contains all the items in the set in order.

    Memberof

    ReadonlyRoaringBitmap32

  • It behaves like array.toReversed. Returns a new array that is this set sorted in reverse order. WARNING: The returned array may be very big, up to 4 billion elements.

    Returns number[]

    An array containing the elements of this set in reverse order (descending).

  • Creates a new plain JS Set and fills it with all the values in the bitmap.

    The returned set may be very big, use this function only when you know what you are doing.

    Parameters

    • Optional maxLength: number

      The maximum number of elements to return.

    Returns Set<number>

    A new plain JS array that contains all the items in the set in order.

    Memberof

    ReadonlyRoaringBitmap32

  • Adds all the values in this bitmap to the given plain JS Set.

    The resulting set may be very big, use this function only when you know what you are doing.

    Parameters

    • output: Set<number>

      The output set.

    • Optional maxLength: number

      The maximum number of elements to return.

    Returns Set<number>

    The output set.

    Memberof

    ReadonlyRoaringBitmap32

  • It behaves like array.toSorted. Returns a new array that is this set sorted according to the compare function. If no sorting function is provided, the array is sorted according to the numeric order of the values (the same as calling this.toArray()).

    WARNING: The returned array may be very big, up to 4 billion elements. WARNING: Is not allowed to change the bitmap while iterating. Undefined behaviour.

    Parameters

    • Optional cmp: ((a, b) => number)

      A function that defines an alternative sort order. The sort method calls the compareFunction function once for each element in the array.

        • (a, b): number
        • Parameters

          • a: number
          • b: number

          Returns number

    Returns number[]

    A new sorted array that contains all the elements of this set.

  • Returns always "ReadonlyRoaringBitmap32".

    To have a standard string representation of the content as a string, call contentToString() instead.

    Returns string

    "ReadonlyRoaringBitmap32"

    Memberof

    ReadonlyRoaringBitmap32

  • Creates a new Uint32Array and fills it with all the values in the bitmap.

    The returned array may be very big, up to 4 billion elements.

    Use this function only when you know what you are doing.

    This function is faster than calling new Uint32Array(bitmap);

    See rangeUint32Array to paginate.

    Returns Uint32Array

    A new Uint32Array instance containing all the items in the set in order.

    Memberof

    ReadonlyRoaringBitmap32

  • Creates a new Uint32Array and fills it with all the values in the bitmap up to the given length.

    See rangeUint32Array to paginate.

    Parameters

    • maxSize: number

    Returns Uint32Array

    A new Uint32Array instance containing all the items in the set in order.

    Memberof

    ReadonlyRoaringBitmap32

  • Copies all the values in the roaring bitmap to an Uint32Array.

    This function is faster than calling new Uint32Array(bitmap); Throws if the given array is not a valid Uint32Array or Int32Array or is not big enough.

    See rangeUint32Array to paginate.

    Parameters

    • output: ArrayBuffer | SharedArrayBuffer | Int32Array | Uint32Array

      The output array.

    Returns Uint32Array

    The output array. Limited to the resulting size.

    Memberof

    ReadonlyRoaringBitmap32

  • Creates a new Uint32Array and fills it with all the values in the bitmap, asynchronously. The bitmap will be temporarily frozen until the operation completes.

    The returned array may be very big, up to 4 billion elements.

    Use this function only when you know what you are doing.

    This function is faster than calling new Uint32Array(bitmap);

    See rangeUint32Array to paginate.

    Returns Promise<Uint32Array>

    A new Uint32Array instance containing all the items in the set in order.

    Memberof

    ReadonlyRoaringBitmap32

  • Copies all the values in the roaring bitmap to an Uint32Array, asynchronously. The bitmap will be temporarily frozen until the operation completes.

    This function is faster than calling new Uint32Array(bitmap); Throws if the given array is not a valid Uint32Array or Int32Array or is not big enough.

    See rangeUint32Array to paginate.

    Parameters

    • output: ArrayBuffer | SharedArrayBuffer | Int32Array | Uint32Array

      The output array.

    Returns Promise<Uint32Array>

    The output array. Limited to the resulting size.

    Memberof

    ReadonlyRoaringBitmap32

  • Tries to add the given value (or values) to the set.

    Returns true if the value (or at least one value) was added during this call, false if already existing or not a valid value.

    Parameters

    • Rest ...values: (undefined | null | string | number)[]

      The values to add.

    Returns boolean

    True if operation was succesfull (values were added), false if not (values did not exists or are invalid values).

    Memberof

    RoaringBitmap32

  • Computes the size of the symmetric difference (xor) between two bitmaps.

    Returns -1 if the given argument is not a ReadonlyRoaringBitmap32 instance.

    Parameters

    Returns number

    The number of elements in common.

    Memberof

    ReadonlyRoaringBitmap32

  • Performs the symmetric union (xor) between the current bitmap and the provided bitmap, writing the result in the current bitmap.

    Is faster to use Uint32Array instead of arrays or iterables.

    This function is optimized if the argument is an instance of RoaringBitmap32.

    The provided bitmap is not modified.

    Parameters

    • values: Iterable<number>

      A RoaringBitmap32 instance or an iterable of unsigned 32 bit integers.

    Returns this

    This RoaringBitmap32 instance.

    Memberof

    RoaringBitmap32

  • addOffset adds the value 'offset' to each and every value in a bitmap, generating a new bitmap in the process. If offset + element is outside of the range [0,2^32), that the element will be dropped.

    Parameters

    • input: ReadonlyRoaringBitmap32

      The input bitmap.

    • offset: number

      The offset to add to each element. Can be positive or negative.

    Returns RoaringBitmap32

    A new bitmap with the offset added to each element.

  • Creates a new buffer with the given size and alignment. If alignment is not specified, the default alignment of 32 is used. The buffer does not come from the nodejs buffer pool, it is allocated using aligned_malloc.

    Is the same as Buffer.alloc but is aligned. We need an aligned buffer to create a roaring bitmap frozen view.

    Parameters

    • size: number

      The size of the buffer to allocate.

    • Optional alignment: number

      The alignment of the buffer to allocate.

    Returns Buffer

    Static

    Memberof

    RoaringBitmap32

  • Creates a new buffer backed by a SharedArrayBuffer with the given size and alignment. If alignment is not specified, the default alignment of 32 is used. The buffer does not come from the nodejs buffer pool, it is allocated using aligned_malloc.

    Is the same as Buffer.alloc but is aligned and uses a SharedArrayBuffer as storage. We need an aligned buffer to create a roaring bitmap frozen view.

    Parameters

    • size: number

      The size of the buffer to allocate.

    • Optional alignment: number

      The alignment of the buffer to allocate.

    Returns Buffer

  • Creates a new buffer backed by a SharedArrayBuffer with the given size and alignment. If alignment is not specified, the default alignment of 32 is used. The buffer does not come from the nodejs buffer pool, it is allocated using aligned_malloc.

    Is the same as Buffer.allocUnsafe but is aligned and uses a SharedArrayBuffer as storage. We need an aligned buffer to create a roaring bitmap frozen view.

    WARNING: this function is unsafe because the returned buffer may contain previously unallocated memory that may contain sensitive data.

    Parameters

    • size: number

      The size of the buffer to allocate.

    • Optional alignment: number

      The alignment of the buffer to allocate.

    Returns Buffer

  • Creates a new buffer not initialized with the given size and alignment. If alignment is not specified, the default alignment of 32 is used. The buffer does not come from the nodejs buffer pool, it is allocated using aligned_malloc.

    Is the same as Buffer.allocUnsafe but is aligned. We need an aligned buffer to create a roaring bitmap frozen view.

    WARNING: this function is unsafe because the returned buffer may contain previously unallocated memory that may contain sensitive data.

    Parameters

    • size: number

      The size of the buffer to allocate.

    • Optional alignment: number

      The alignment of the buffer to allocate.

    Returns Buffer

    Static

    Memberof

    RoaringBitmap32

  • Deserializes the bitmap from an Uint8Array or a Buffer.

    Returns a new RoaringBitmap32 instance.

    Setting the portable flag to false enable a custom format that can save space compared to the portable format (e.g., for very sparse bitmaps). The portable version is meant to be compatible with Java and Go versions. When a frozen format is used, the buffer will be copied and the bitmap will be frozen.

    NOTE: this field was optional before, now is required and an Error is thrown if the portable flag is not passed.

    Parameters

    • serialized: undefined | null | ArrayBuffer | SharedArrayBuffer | Int8Array | Uint8Array | Uint8ClampedArray

      An Uint8Array or a node Buffer that contains the serialized data.

    • format: DeserializationFormatType

      The format of the serialized data. true means "portable". false means "croaring".

    Returns RoaringBitmap32

    A new RoaringBitmap32 instance.

    Static

    Memberof

    RoaringBitmap32

  • Deserializes the bitmap from an Uint8Array or a Buffer asynchrnously in a parallel thread.

    Returns a Promise that resolves to a new RoaringBitmap32 instance.

    The portable version is meant to be compatible with Java and Go versions. The croaring version is compatible with the C version, it can be smaller than the portable version. When a frozen format is used, the buffer will be copied and the bitmap will be frozen.

    Parameters

    • serialized: undefined | null | ArrayBuffer | SharedArrayBuffer | Int8Array | Uint8Array | Uint8ClampedArray

      An Uint8Array or a node Buffer that contains the serialized data.

    • format: DeserializationFormatType

      The format of the serialized data. true means "portable". false means "croaring".

    Returns Promise<RoaringBitmap32>

    A promise that resolves to a new RoaringBitmap32 instance.

    Static

    Memberof

    RoaringBitmap32

  • Deserializes the bitmap from an Uint8Array or a Buffer asynchrnously in a parallel thread.

    When deserialization is completed or failed, the given callback will be executed.

    The portable version is meant to be compatible with Java and Go versions. The croaring version is compatible with the C version, it can be smaller than the portable version. When a frozen format is used, the buffer will be copied and the bitmap will be frozen.

    Parameters

    • serialized: undefined | null | ArrayBuffer | SharedArrayBuffer | Int8Array | Uint8Array | Uint8ClampedArray

      An Uint8Array or a node Buffer that contains the.

    • format: DeserializationFormatType

      The format of the serialized data. true means "portable". false means "croaring".

    • callback: RoaringBitmap32Callback

      The callback to execute when the operation completes.

    Returns void

    Static

    Memberof

    RoaringBitmap32

  • Deserializes the bitmap from a file asynchronously. Returns a new RoaringBitmap32 instance.

    The portable version is meant to be compatible with Java and Go versions. The croaring version is compatible with the C version, it can be smaller than the portable version. When a frozen format is used, the buffer will be copied and the bitmap will be frozen.

    This is faster, everything runs in its own thread and it consumes less memory than serializing to a Buffer and then to write to a file, internally it uses memory mapped files and skip all the JS overhead.

    Parameters

    • filePath: string

      The path of the file to read.

    • format: FileDeserializationFormatType

      The format of the serialized data. true means "portable". false means "croaring".

    Returns Promise<RoaringBitmap32>

    A promise that resolves to a new RoaringBitmap32 instance.

    Static

    Memberof

    RoaringBitmap32

  • Deserializes many bitmaps from an array of Uint8Array or an array of Buffer asynchronously in multiple parallel threads.

    Returns a Promise that resolves to an array of new RoaringBitmap32 instance.

    Setting the portable flag to false enable a custom format that can save space compared to the portable format (e.g., for very sparse bitmaps). The portable version is meant to be compatible with Java and Go versions. When a frozen format is used, the buffer will be copied and the bitmap will be frozen.

    NOTE: portable argument was optional before, now is required and an Error is thrown if the portable flag is not passed.

    Parameters

    • serialized: (undefined | null | ArrayBuffer | SharedArrayBuffer | Int8Array | Uint8Array | Uint8ClampedArray)[]

      An Uint8Array or a node Buffer that contains the serialized data.

    • format: DeserializationFormatType

      The format of the serialized data. true means "portable". false means "croaring".

    Returns Promise<RoaringBitmap32[]>

    A promise that resolves to a new RoaringBitmap32 instance.

    Static

    Memberof

    RoaringBitmap32

  • Deserializes many bitmaps from an array of Uint8Array or an array of Buffer asynchronously in a parallel thread.

    Deserialization in the parallel thread will be executed in sequence, if one fails, all fails.

    Setting the portable flag to false enable a custom format that can save space compared to the portable format (e.g., for very sparse bitmaps). The portable version is meant to be compatible with Java and Go versions. When a frozen format is used, the buffer will be copied and the bitmap will be frozen.

    NOTE: portable argument was optional before, now is required and an Error is thrown if the portable flag is not passed.

    When deserialization is completed or failed, the given callback will be executed.

    Parameters

    • serialized: readonly (ArrayBuffer | SharedArrayBuffer | Int8Array | Uint8Array | Uint8ClampedArray)[]

      An array of Uint8Array or node Buffers that contains the non portable serialized data.

    • format: DeserializationFormatType

      The format of the serialized data. true means "portable". false means "croaring".

    • callback: RoaringBitmap32ArrayCallback

      The callback to execute when the operation completes.

    Returns void

    Static

    Memberof

    RoaringBitmap32

  • Ensures that the given buffer is aligned to the given alignment. If alignment is not specified, the default alignment of 32 is used. If the buffer is already aligned, it is returned. If the buffer is not aligned, a new aligned buffer is created with bufferAlignedAllocUnsafe and the data is copied.

    Parameters

    • buffer: ArrayBuffer | SharedArrayBuffer | Int8Array | Uint8Array | Uint8ClampedArray | Buffer

      The buffer to align.

    • Optional alignment: number

      The alignment to align to.

    Returns Buffer

    The aligned buffer. Can be the same as the input buffer if it was already aligned. Can be a new buffer if the input buffer was not aligned.

    Static

    Memberof

    RoaringBitmap32

  • Creates an instance of RoaringBitmap32 from the given Iterable.

    Is faster to pass a Uint32Array instance instead of an array or an iterable.

    Is optimized if the given argument is a RoaringBitmap32 (performs a fast copy).

    Parameters

    • values: Iterable<number>

      The values to set.

    Returns RoaringBitmap32

    A new RoaringBitmap32 instance filled with the given values.

    Static

    Memberof

    RoaringBitmap32

  • Creates an instance of RoaringBitmap32 from the given Iterable asynchronously in a parallel thread.

    If a plain array or a plain iterable is passed, a temporary Uint32Array will be created synchronously.

    NOTE: This method will throw a TypeError if a RoaringBitmap32 is passed as argument.

    Returns a Promise that resolves to a new RoaringBitmap32 instance.

    Parameters

    • values: undefined | null | Iterable<number>

      The values to set. Cannot be a RoaringBitmap32.

    Returns Promise<RoaringBitmap32>

    A promise that resolves to a new RoaringBitmap32 instance filled with all the given values.

    Static

    Memberof

    RoaringBitmap32

  • Creates an instance of RoaringBitmap32 from the given Iterable asynchronously in a parallel thread.

    If a plain array or a plain iterable is passed, a temporary Uint32Array will be created synchronously.

    NOTE: This method will throw a TypeError if a RoaringBitmap32 is passed as argument.

    When deserialization is completed or failed, the given callback will be executed.

    Parameters

    • values: undefined | null | Iterable<number>

      The values to set. Cannot be a RoaringBitmap32.

    • callback: RoaringBitmap32Callback

      The callback to execute when the operation completes.

    Returns void

    Static

    Memberof

    RoaringBitmap32

  • Creates a new bitmap that contains all the values in the interval: [rangeStart, rangeEnd). Is possible to specify the step parameter to have a non contiguous range.

    Parameters

    • rangeStart: undefined | number

      The start index. Trimmed to 0.

    • Optional rangeEnd: number

      The end index. Trimmed to 4294967297.

    • Optional step: number

      The increment step, defaults to 1.

    Returns RoaringBitmap32

    A new RoaringBitmap32 instance.

    Static

    Memberof

    RoaringBitmap32

  • Gets the total number of allocated RoaringBitmap32 globally. Useful for debugging memory issues and GC.

    Returns number

  • Gets the approximate memory allocated by the roaring bitmap library. Useful for debugging memory issues and GC.

    Returns number

  • Checks if the given buffer is memory aligned. If alignment is not specified, the default alignment of 32 is used.

    Parameters

    • buffer: undefined | null | ArrayBuffer | SharedArrayBuffer | Buffer | TypedArray

      The buffer to check.

    • Optional alignment: number

      The alignment to check.

    Returns boolean

  • The RoaringBitmap32.of() static method creates a new Array instance from a variable number of arguments, regardless of number or type of the arguments. Note that is faster to pass a Uint32Array instance instead of an array or an iterable.

    Parameters

    • Rest ...values: (undefined | null | string | number)[]

      A set of values to add to the new RoaringBitmap32 instance.

    Returns RoaringBitmap32

    A new RoaringBitmap32 instance.

    Static

  • Performs a union between all the given array of RoaringBitmap32 instances.

    This function is faster than calling or multiple times.

    Parameters

    Returns RoaringBitmap32

    A new RoaringBitmap32 that contains the union of all the given bitmaps.

    Static

    Memberof

    RoaringBitmap32

  • Performs a union between all the given RoaringBitmap32 instances.

    This function is faster than calling or multiple times.

    Parameters

    Returns RoaringBitmap32

    A new RoaringBitmap32 that contains the union of all the given bitmaps.

    Static

    Memberof

    RoaringBitmap32

  • Swaps the content of two RoaringBitmap32 instances.

    Parameters

    Returns void

    Static

    Memberof

    RoaringBitmap32

  • This is an unsafe method that builds a frozen roaring bitmap over a buffer. This removes the overhead of a deserialization of a large bitmap. The buffer will be kept alive by the bitmap. This function is endian sensitive, it supports only little endian and cannot load frozen bitmaps saved on big endian machines.

    This function is considered unsafe because if the buffer gets modified, the bitmap will be corrupted and the application can crash. There is a risk for buffer overrun or arbitrary code execution here. Be careful and do not allow the buffer to be modified while or after the bitmap is in use.

    The content of buffer should not be modified until the bitmap is destroyed! Is responsibility of the caller to ensure that the buffer is not modified while the bitmap is in use.

    Using "unsafe_frozen_croaring" the buffer data must be aligned to 32 bytes. The roaring library provides the functions bufferAlignedAlloc, bufferAlignedAllocUnsafe, isBufferAligned, ensureBufferAligned that helps allocating and managing aligned buffers. If you read a file, or read from database, be careful to use an aligned buffer or copy to an aligned buffer before calling this function with "unsafe_frozen_croaring" format.

    Is considered unsafe and unstable because the format might change at any new version. Can be useful for temporary storage or for sending data over the network between similar machines. If the content is corrupted when loaded or the buffer is modified when a frozen view is create, the behavior is undefined! The application may crash, buffer overrun, could be a vector of attack!

    Parameters

    • storage: ArrayBuffer | SharedArrayBuffer | Int8Array | Uint8Array | Uint8ClampedArray | Buffer

      A Buffer that contains the serialized data.

    • format: FrozenViewFormatType

      The format of the serialized data. true means "portable". false means "croaring".

    Returns RoaringBitmap32

    A new RoaringBitmap32 instance.

    Static

    Memberof

    RoaringBitmap32

  • Performs a xor between all the given array of RoaringBitmap32 instances.

    This function is faster than calling xor multiple times.

    Parameters

    Returns RoaringBitmap32

    A new RoaringBitmap32 that contains the xor of all the given bitmaps.

    Static

    Memberof

    RoaringBitmap32

  • Performs a xor between all the given RoaringBitmap32 instances.

    This function is faster than calling xor multiple times.

    Parameters

    Returns RoaringBitmap32

    A new RoaringBitmap32 that contains the xor of all the given bitmaps.

    Static

    Memberof

    RoaringBitmap32

Generated using TypeDoc