Skip to content

Rose::StringUtility::toHex2

Convert a number to a hexadecimal and decimal string.

Synopsis

Declared in <src/Rose/StringUtility/NumberToString.h>

[[visibility]]
std::string
toHex2(
    uint64_t value,
    size_t nbits,
    bool show_unsigned_decimal = true,
    bool show_signed_decimal = true,
    uint64_t decimal_threshold = 256);

Description

The returned string starts with the hexadecimal representation of the number and an optional decimal representation in angle brackets. The decimal portion will contain a signed and/or unsigned value depending on whether the value is interpretted as signed and whether the sign bit is set. The signedToHex versions print the decimal value for only the signed interpretation; the unsignedToHex versions print only the decimal unsigned interpretation, and the toHex versions print both (but not redunantly).

@{

Return Value

Formatted string.

Parameters

Name

Description

value

Input value.

nbits

Bit width to display.

show_unsigned_decimal

Whether to show unsigned decimal.

show_signed_decimal

Whether to show signed decimal.

decimal_threshold

Threshold for showing decimal.

Created with MrDocs