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;
auto bytes = bit_converter::get_bytes(value);
auto int_value = bit_converter::to_int32(bytes, 0);
console::write_line("{0} = {1}: {2}", value, int_value, value == int_value ? "Round-trips" : "Does not round-trip");
auto uint_value = bit_converter::to_uint32(bytes, 0);
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);
#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:175
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition xtd_about_box.hpp:10