Skip to content

Int

#include <tpau-cpp-kernal/Int.h>

INCLUDE FILE
#include <tpau-cpp-kernal/Int.h>

class Int

This class provides static methods for various integer utility functions.

DEFINITION
class Int;

method alignstatic

Align the given value to the specified alignment.

DEFINITION
static size_t  align ( size_t  value,
size_t  alignment );
PARAMETERDESCRIPTION
value

The value to align.

alignment

The alignment boundary.

RETURNSDESCRIPTION
size_t

The aligned value.

method encodestatic

Encode the given signed integer value into a string of bytes.

DEFINITION
static void  encode ( std::string & bytes,
int64_t  value,
uint64_t  size,
uint64_t  byte_order );
PARAMETERDESCRIPTION
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.

DEFINITION
static void  encode ( std::string & bytes,
uint64_t  value,
uint64_t  size,
uint64_t  byte_order );
PARAMETERDESCRIPTION
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.

DEFINITION
static size_t  minimum_byte_size ( int64_t  value );
PARAMETERDESCRIPTION
value

The signed integer value.

RETURNSDESCRIPTION
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.

DEFINITION
static size_t  minimum_byte_size ( uint64_t  value );
PARAMETERDESCRIPTION
value

The unsigned integer value.

RETURNSDESCRIPTION
size_t

The minimum number of bytes required to represent the value.