Shows how to use bit_converter class.
#include <xtd/bit_converter>
#include <xtd/console>
#include <xtd/startup>
namespace bit_converter_round_trips_example {
class program {
public:
static auto main() {
auto value = -16;
console::write_line(
"{0} = {1}: {2}", value, int_value, value == int_value ?
"Round-trips" :
"Does not round-trip");
console::write_line(
"{0} = {1}: {2}", value, uint_value,
static_cast<uint
>(value) == uint_value ?
"Round-trips" :
"Does not round-trip");
}
};
}
startup_(bit_converter_round_trips_example::program::main);
static int32 to_int32(const xtd::array< xtd::byte > &value, xtd::size start_index)
Returns a 32-bit signed integer converted from two bytes at a specified position in a xtd::byte xtd::...
static uint32 to_uint32(const xtd::array< xtd::byte > &value, xtd::size start_index)
Returns a 32-bit signed integer converted from two bytes at a specified position in a xtd::byte xtd::...
static xtd::array< xtd::byte > get_bytes(bool value) noexcept
Returns the specified Boolean value as an xtd::array of bytes.
static void write_line()
Writes the current line terminator to the standard output stream using the specified format informati...
#define startup_(main_method)
Defines the entry point to be called when the application loads. Generally this is set either to the ...
Definition startup.hpp:168
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition abstract_object.hpp:8