JASSv2
Public Member Functions | Static Public Member Functions | Protected Types | Static Protected Member Functions | Static Protected Attributes | Static Private Member Functions | List of all members
JASS::compress_integer_elias_gamma_simd Class Reference

Pack 32-bit integers into 512-bit SIMD words using prn and carryover. More...

#include <compress_integer_elias_gamma_simd.h>

Inheritance diagram for JASS::compress_integer_elias_gamma_simd:
Inheritance graph
[legend]
Collaboration diagram for JASS::compress_integer_elias_gamma_simd:
Collaboration graph
[legend]

Public Member Functions

virtual size_t encode (void *encoded, size_t encoded_buffer_length, const integer *source, size_t source_integers)
 Encode a sequence of integers returning the number of bytes used for the encoding, or 0 if the encoded sequence doesn't fit in the buffer. More...
 
virtual void decode (integer *decoded, size_t integers_to_decode, const void *source, size_t source_length)
 Decode a sequence of integers encoded with this codex. More...
 
virtual long long compress (unsigned char *destination, long long destination_length, uint32_t *source, long long source_integers)
 
virtual void decompress (uint32_t *destination, unsigned char *source, long long destination_integers)
 
virtual size_t encode (void *encoded, size_t encoded_buffer_length, const integer *source, size_t source_integers)
 Encode a sequence of integers returning the number of bytes used for the encoding, or 0 if the encoded sequence doesn't fit in the buffer. More...
 
virtual void decode (integer *decoded, size_t integers_to_decode, const void *source, size_t source_length)
 Decode a sequence of integers encoded with this codex. More...
 
- Public Member Functions inherited from JASS::compress_integer
 compress_integer ()
 Constructor.
 
virtual ~compress_integer ()
 Destructor.
 

Static Public Member Functions

static void unittest (void)
 Unit test this class.
 
static void unittest (void)
 Unit test this class.
 
- Static Public Member Functions inherited from JASS::compress_integer
static size_t d1_encode (integer *encoded, const integer *source, size_t source_integers)
 Convert an array of integers into an array of D1 (delta, d-gap) encoded integers. More...
 
static size_t d1_decode (integer *decoded, const integer *source, size_t source_integers)
 Convert a D1 encoded array of integers into an array of integers. More...
 
static size_t dn_encode (integer *encoded, const integer *source, size_t source_integers, size_t n=1)
 Convert an array of integers into an array of Dn (delta, d-gap) encoded integers with a gap of n. More...
 
static size_t dn_decode (integer *decoded, const integer *source, size_t source_integers, size_t n=1)
 Convert a Dn encoded array of integers into an array of integers. More...
 
static void unittest_one (compress_integer &encoder, const std::vector< uint32_t > &sequence)
 Test one sequence to make sure it encodes and decodes to the same thing. Assert if not. More...
 
static void unittest (compress_integer &compressor, uint32_t staring_from=0)
 Unit test this class, assert on failure. More...
 

Protected Types

typedef uint32_t integer
 

Static Protected Member Functions

static uint32_t compute_selector (const uint8_t *encodings)
 Computer the selector to use for this encoding. More...
 
static forceinline uint64_t find_first_set_bit (uint64_t value)
 return the position of the least significant set bit (using a single machine code instruction) More...
 

Static Protected Attributes

static const uint32_t mask_set [33][16]
 

Static Private Member Functions

static uint32_t compute_selector (const uint8_t *encodings)
 Computer the selector to use for this encoding. More...
 
static forceinline uint64_t find_first_set_bit (uint64_t value)
 return the position of the least significant set bit (using a single machine code instruction) More...
 

Additional Inherited Members

- Public Types inherited from JASS::compress_integer
typedef uint32_t integer
 This class and descendants will work on integers of this size. Do not change without also changing JASS_COMPRESS_INTEGER_BITS_PER_INTEGER.
 

Detailed Description

Pack 32-bit integers into 512-bit SIMD words using prn and carryover.

Member Function Documentation

◆ compute_selector() [1/2]

static uint32_t JASS::compress_integer_elias_gamma_simd::compute_selector ( const uint8_t *  encodings)
staticprotected

Computer the selector to use for this encoding.

Parameters
encodings[in] The width (in bits) of the (at most) 32 integers. The first integer is at encodngs[0]. leading 0s are used to mark fewer than 32 integers.
Returns
The selector encoded as an integer

◆ compute_selector() [2/2]

uint32_t JASS::compress_integer_elias_gamma_simd::compute_selector ( const uint8_t *  encodings)
staticprivate

Computer the selector to use for this encoding.

Parameters
encodings[in] The width (in bits) of the (at most) 32 integers. The first integer is at encodngs[0]. leading 0s are used to mark fewer than 32 integers.
Returns
The selector encoded as an integer

◆ decode() [1/2]

virtual void JASS::compress_integer_elias_gamma_simd::decode ( integer *  decoded,
size_t  integers_to_decode,
const void *  source,
size_t  source_length 
)
virtual

Decode a sequence of integers encoded with this codex.

Parameters
decoded[out] The sequence of decoded integers.
integers_to_decode[in] The minimum number of integers to decode (it may decode more).
source[in] The encoded integers.
source_length[in] The length (in bytes) of the source buffer.

Implements JASS::compress_integer.

◆ decode() [2/2]

void JASS::compress_integer_elias_gamma_simd::decode ( integer *  decoded,
size_t  integers_to_decode,
const void *  source,
size_t  source_length 
)
virtual

Decode a sequence of integers encoded with this codex.

Parameters
decoded[out] The sequence of decoded integers.
integers_to_decode[in] The minimum number of integers to decode (it may decode more).
source[in] The encoded integers.
source_length[in] The length (in bytes) of the source buffer.

Implements JASS::compress_integer.

◆ encode() [1/2]

virtual size_t JASS::compress_integer_elias_gamma_simd::encode ( void *  encoded,
size_t  encoded_buffer_length,
const integer *  source,
size_t  source_integers 
)
virtual

Encode a sequence of integers returning the number of bytes used for the encoding, or 0 if the encoded sequence doesn't fit in the buffer.

Parameters
encoded[out] The sequence of bytes that is the encoded sequence.
encoded_buffer_length[in] The length (in bytes) of the output buffer, encoded.
source[in] The sequence of integers to encode.
source_integers[in] The length (in integers) of the source buffer.
Returns
The number of bytes used to encode the integer sequence, or 0 on error (i.e. overflow).

Implements JASS::compress_integer.

◆ encode() [2/2]

size_t JASS::compress_integer_elias_gamma_simd::encode ( void *  encoded,
size_t  encoded_buffer_length,
const integer *  source,
size_t  source_integers 
)
virtual

Encode a sequence of integers returning the number of bytes used for the encoding, or 0 if the encoded sequence doesn't fit in the buffer.

Parameters
encoded[out] The sequence of bytes that is the encoded sequence.
encoded_buffer_length[in] The length (in bytes) of the output buffer, encoded.
source[in] The sequence of integers to encode.
source_integers[in] The length (in integers) of the source buffer.
Returns
The number of bytes used to encode the integer sequence, or 0 on error (i.e. overflow).

Implements JASS::compress_integer.

◆ find_first_set_bit() [1/2]

static forceinline uint64_t JASS::compress_integer_elias_gamma_simd::find_first_set_bit ( uint64_t  value)
inlinestaticprotected

return the position of the least significant set bit (using a single machine code instruction)

Parameters
[in]valuethe integer to check.
Returns
The position of the lowest set bit (or 0 if no bits are set)

◆ find_first_set_bit() [2/2]

static forceinline uint64_t JASS::compress_integer_elias_gamma_simd::find_first_set_bit ( uint64_t  value)
inlinestaticprivate

return the position of the least significant set bit (using a single machine code instruction)

Parameters
[in]valuethe integer to check.
Returns
The position of the lowest set bit (or 0 if no bits are set)

The documentation for this class was generated from the following files: