Int
#include <tpau-cpp-kernal/Int.h>
class Int
This class provides static methods for various integer utility functions.
method alignstatic
Align the given value to the specified alignment.
| static size_t align | ( | size_t value, | |
| size_t alignment | ); |
| PARAMETER | DESCRIPTION |
|---|---|
value |
The value to align. |
alignment |
The alignment boundary. |
| RETURNS | DESCRIPTION |
|---|---|
size_t |
The aligned value. |
method encodestatic
Encode the given signed integer value into a string of bytes.
| static void encode | ( | std::string & bytes, | |
| int64_t value, | |||
| uint64_t size, | |||
| uint64_t byte_order | ); |
| PARAMETER | DESCRIPTION |
|---|---|
bytes |
The string to append the encoded bytes to. |
value |
The signed integer value to encode. |
size |
The number of bytes to use for the encoding. If 0, the minimum number of bytes required to represent the value will be used. |
byte_order |
The byte order to use for the encoding. |
method encodestatic
Encode the given unsigned integer value into a string of bytes.
| static void encode | ( | std::string & bytes, | |
| uint64_t value, | |||
| uint64_t size, | |||
| uint64_t byte_order | ); |
| PARAMETER | DESCRIPTION |
|---|---|
bytes |
The string to append the encoded bytes to. |
value |
The unsigned integer value to encode. |
size |
The number of bytes to use for the encoding. If 0, the minimum number of bytes required to represent the value will be used. |
byte_order |
The byte order to use for the encoding. |
method minimum_byte_sizestatic
Get the minimum number of bytes required to represent the given signed integer value.
| static size_t minimum_byte_size | ( | int64_t value | ); |
| PARAMETER | DESCRIPTION |
|---|---|
value |
The signed integer value. |
| RETURNS | DESCRIPTION |
|---|---|
size_t |
The minimum number of bytes required to represent the value. |
method minimum_byte_sizestatic
Get the minimum number of bytes required to represent the given unsigned integer value.
| static size_t minimum_byte_size | ( | uint64_t value | ); |
| PARAMETER | DESCRIPTION |
|---|---|
value |
The unsigned integer value. |
| RETURNS | DESCRIPTION |
|---|---|
size_t |
The minimum number of bytes required to represent the value. |