Class Packed64
Space optimized random access capable array of values with a fixed number of bits/value. Values are packed contiguously.
The implementation strives to perform af fast as possible under the constraint of contiguous bits, by avoiding expensive operations. This comes at the cost of code clarity. Technical details: this implementation is a refinement of a non-branching version. The non-branching get and set methods meant that 2 or 4 atomics in the underlying array were always accessed, even for the cases where only 1 or 2 were needed. Even with caching, this had a detrimental effect on performance. Related to this issue, the old implementation used lookup tables for shifts and masks, which also proved to be a bit slower than calculating the shifts and masks on the fly. See https://issues.apache.org/jira/browse/LUCENE-4062 for details.Inheritance
Inherited Members
Namespace: Lucene.Net.Util.Packed
Assembly: Lucene.Net.dll
Syntax
public class Packed64 : PackedInt32s.MutableImpl
Constructors
Packed64(int, DataInput, int, int)
Creates an array with content retrieved from the given DataInput.
Declaration
public Packed64(int packedIntsVersion, DataInput @in, int valueCount, int bitsPerValue)
Parameters
| Type | Name | Description |
|---|---|---|
| int | packedIntsVersion | |
| DataInput | in | A DataInput, positioned at the start of Packed64-content. |
| int | valueCount | The number of elements. |
| int | bitsPerValue | The number of bits available for any given value. |
Exceptions
| Type | Condition |
|---|---|
| IOException | If the values for the backing array could not be retrieved. |
Packed64(int, int)
Creates an array with the internal structures adjusted for the given limits and initialized to 0.
Declaration
public Packed64(int valueCount, int bitsPerValue)
Parameters
| Type | Name | Description |
|---|---|---|
| int | valueCount | The number of elements. |
| int | bitsPerValue | The number of bits available for any given value. |
Methods
Clear()
Sets all values to 0.
Declaration
public override void Clear()
Overrides
Fill(int, int, long)
Fill the mutable from fromIndex (inclusive) to
toIndex (exclusive) with val.
Declaration
public override void Fill(int fromIndex, int toIndex, long val)
Parameters
| Type | Name | Description |
|---|---|---|
| int | fromIndex | |
| int | toIndex | |
| long | val |
Overrides
Get(int)
Space optimized random access capable array of values with a fixed number of bits/value. Values are packed contiguously.
The implementation strives to perform af fast as possible under the constraint of contiguous bits, by avoiding expensive operations. This comes at the cost of code clarity. Technical details: this implementation is a refinement of a non-branching version. The non-branching get and set methods meant that 2 or 4 atomics in the underlying array were always accessed, even for the cases where only 1 or 2 were needed. Even with caching, this had a detrimental effect on performance. Related to this issue, the old implementation used lookup tables for shifts and masks, which also proved to be a bit slower than calculating the shifts and masks on the fly. See https://issues.apache.org/jira/browse/LUCENE-4062 for details.Declaration
public override long Get(int index)
Parameters
| Type | Name | Description |
|---|---|---|
| int | index | The position of the value. |
Returns
| Type | Description |
|---|---|
| long | The value at the given index. |
Overrides
Get(int, long[], int, int)
Bulk get: read at least one and at most len longs starting
from index into arr[off:off+len] and return
the actual number of values that have been read.
Declaration
public override int Get(int index, long[] arr, int off, int len)
Parameters
| Type | Name | Description |
|---|---|---|
| int | index | |
| long[] | arr | |
| int | off | |
| int | len |
Returns
| Type | Description |
|---|---|
| int |
Overrides
RamBytesUsed()
Return the in-memory size in bytes.
Declaration
public override long RamBytesUsed()
Returns
| Type | Description |
|---|---|
| long |
Overrides
Set(int, long)
Set the value at the given index in the array.
Declaration
public override void Set(int index, long value)
Parameters
| Type | Name | Description |
|---|---|---|
| int | index | Where the value should be positioned. |
| long | value | A value conforming to the constraints set by the array. |
Overrides
Set(int, long[], int, int)
Bulk set: set at least one and at most len longs starting
at off in arr into this mutable, starting at
index. Returns the actual number of values that have been
set.
Declaration
public override int Set(int index, long[] arr, int off, int len)
Parameters
| Type | Name | Description |
|---|---|---|
| int | index | |
| long[] | arr | |
| int | off | |
| int | len |
Returns
| Type | Description |
|---|---|
| int |
Overrides
ToString()
Returns a string that represents the current object.
Declaration
public override string ToString()
Returns
| Type | Description |
|---|---|
| string | A string that represents the current object. |