Class for encoding and decoding four 32-bit integer values as a unit.
More...
#include "nn/nlib/GroupVarInt.h"
|
static size_t | GetEncodedSize (uint32_t v0, uint32_t v1, uint32_t v2, uint32_t v3) noexcept |
| Returns the size of the encoded four integer values. More...
|
|
static size_t | GetEncodedSize (const uint32_t *p) noexcept |
| Returns the size of the encoded four integer values. More...
|
|
static size_t | GetNextGroupSize (const uint8_t *p) noexcept |
| Returns the number of bytes to be used for decoding to the following four integer values. More...
|
|
static uint8_t * | Encode (uint8_t *p, uint32_t v0, uint32_t v1, uint32_t v2, uint32_t v3) noexcept |
| Encodes four 32-bit integer values. More...
|
|
static uint8_t * | Encode (uint8_t *p, const uint32_t *src) noexcept |
| Encodes four 32-bit integer values. More...
|
|
static const uint8_t * | Decode (uint32_t *v0, uint32_t *v1, uint32_t *v2, uint32_t *v3, const uint8_t *p) noexcept |
| Decodes four 32-bit integer values. More...
|
|
static const uint8_t * | Decode (uint32_t *dest, const uint8_t *p) noexcept |
| Decodes four 32-bit integer values. More...
|
|
static size_t | GetMaxSize (size_t n) noexcept |
| Returns the maximum size of encoded n integer values.
|
|
static size_t | GetTotalSize (const uint32_t *p, size_t n) noexcept |
| Returns the number of bytes required to store encoding results. More...
|
|
Class for encoding and decoding four 32-bit integer values as a unit.
- Description
- Encodes four 32-bit integer values to 5-17 bytes. Describing information on the length of each integer value in the first byte can provide good performance through reduced shifts, masks, and conditional branches during decoding.
- See also
- https://static.googleusercontent.com/media/research.google.com/ja//people/jeff/WSDM09-keynote.pdf
-
https://web.stanford.edu/class/cs276/Jeff-Dean-compression-slides.pdf
-
http://www.stepanovpapers.com/CIKM_2011.pdf
Definition at line 26 of file GroupVarInt.h.
◆ Decode() [1/2]
nn::nlib::GroupVarInt32::Decode |
( |
uint32_t * |
v0, |
|
|
uint32_t * |
v1, |
|
|
uint32_t * |
v2, |
|
|
uint32_t * |
v3, |
|
|
const uint8_t * |
p |
|
) |
| |
|
inlinestaticnoexcept |
Decodes four 32-bit integer values.
- Parameters
-
[out] | v0 | Pointer for storing the decoded 32-bit integer value. |
[out] | v1 | Pointer for storing the decoded 32-bit integer value. |
[out] | v2 | Pointer for storing the decoded 32-bit integer value. |
[out] | v3 | Pointer for storing the decoded 32-bit integer value. |
[in] | p | Pointer to the encoded data. |
- Returns
- Pointer to the location immediately after the data used for decoding.
Definition at line 217 of file GroupVarInt.h.
◆ Decode() [2/2]
nn::nlib::GroupVarInt32::Decode |
( |
uint32_t * |
dest, |
|
|
const uint8_t * |
p |
|
) |
| |
|
inlinestaticnoexcept |
Decodes four 32-bit integer values.
- Parameters
-
[out] | dest | Pointer for storing the four 32-bit integer values. |
[in] | p | Pointer to the encoded data. |
- Returns
- Pointer to the location immediately after the data used for decoding.
Definition at line 208 of file GroupVarInt.h.
◆ Encode() [1/2]
nn::nlib::GroupVarInt32::Encode |
( |
uint8_t * |
p, |
|
|
uint32_t |
v0, |
|
|
uint32_t |
v1, |
|
|
uint32_t |
v2, |
|
|
uint32_t |
v3 |
|
) |
| |
|
inlinestaticnoexcept |
Encodes four 32-bit integer values.
- Parameters
-
[out] | p | Pointer to the location to which encoded data is written. |
[in] | v0 | The 32-bit integer value. |
[in] | v1 | The 32-bit integer value. |
[in] | v2 | The 32-bit integer value. |
[in] | v3 | The 32-bit integer value. |
- Returns
- Pointer to the location immediately after the written data.
Definition at line 97 of file GroupVarInt.h.
◆ Encode() [2/2]
nn::nlib::GroupVarInt32::Encode |
( |
uint8_t * |
p, |
|
|
const uint32_t * |
src |
|
) |
| |
|
inlinestaticnoexcept |
Encodes four 32-bit integer values.
- Parameters
-
[out] | p | Pointer to the location to which encoded data is written. |
[in] | src | Pointer to the four 32-bit integer values. |
- Returns
- Pointer to the location immediately after the written data.
Definition at line 84 of file GroupVarInt.h.
◆ GetEncodedSize() [1/2]
nn::nlib::GroupVarInt32::GetEncodedSize |
( |
uint32_t |
v0, |
|
|
uint32_t |
v1, |
|
|
uint32_t |
v2, |
|
|
uint32_t |
v3 |
|
) |
| |
|
inlinestaticnoexcept |
Returns the size of the encoded four integer values.
- Parameters
-
[in] | v0 | The 32-bit integer value. |
[in] | v1 | The 32-bit integer value. |
[in] | v2 | The 32-bit integer value. |
[in] | v3 | The 32-bit integer value. |
- Returns
- Encoded size.
Definition at line 28 of file GroupVarInt.h.
◆ GetEncodedSize() [2/2]
nn::nlib::GroupVarInt32::GetEncodedSize |
( |
const uint32_t * |
p | ) |
|
|
inlinestaticnoexcept |
Returns the size of the encoded four integer values.
- Parameters
-
[in] | p | Pointer to 32-bit integer values (p[0], p[1], p[2], and p[3] are used). |
- Returns
- Encoded size.
Definition at line 59 of file GroupVarInt.h.
◆ GetNextGroupSize()
nn::nlib::GroupVarInt32::GetNextGroupSize |
( |
const uint8_t * |
p | ) |
|
|
inlinestaticnoexcept |
Returns the number of bytes to be used for decoding to the following four integer values.
- Parameters
-
[in] | p | Pointer to the encoded byte string. |
- Returns
- The number of bytes to be used for decoding.
Definition at line 63 of file GroupVarInt.h.
◆ GetTotalSize()
nn::nlib::GroupVarInt32::GetTotalSize |
( |
const uint32_t * |
p, |
|
|
size_t |
n |
|
) |
| |
|
inlinestaticnoexcept |
Returns the number of bytes required to store encoding results.
- Parameters
-
[in] | p | Pointer to the 32-bit integer value string. |
[in] | n | The number of 32-bit integer values. |
- Returns
- The number of bytes after encoding.
Definition at line 72 of file GroupVarInt.h.
The documentation for this class was generated from the following files: