.. _program_listing_file__tmp_ws_src_ecl_lite_ecl_converters_lite_include_ecl_converters_lite_byte_array.hpp: Program Listing for File byte_array.hpp ======================================= |exhale_lsh| :ref:`Return to documentation for file ` (``/tmp/ws/src/ecl_lite/ecl_converters_lite/include/ecl/converters_lite/byte_array.hpp``) .. |exhale_lsh| unicode:: U+021B0 .. UPWARDS ARROW WITH TIP LEFTWARDS .. code-block:: cpp /***************************************************************************** ** Ifdefs *****************************************************************************/ #ifndef ECL_CONVERTERS_LITE_BYTE_ARRAY_HPP_ #define ECL_CONVERTERS_LITE_BYTE_ARRAY_HPP_ /***************************************************************************** ** Includes *****************************************************************************/ #include /***************************************************************************** ** Namespaces *****************************************************************************/ namespace ecl { /***************************************************************************** ** From Byte Array *****************************************************************************/ void from_byte_array(int32 &value, const signed char* byte_array) { value = 0; for (unsigned int i = 0; i < 4; ++i ) { value |= static_cast(*(byte_array+i)) << 8*i; } } void from_byte_array(int32 &value, const char* byte_array) { value = 0; for (unsigned int i = 0; i < 4; ++i ) { value |= static_cast(*(byte_array+i)) << 8*i; } } void from_byte_array(int32 &value, const unsigned char* byte_array) { value = 0; for (unsigned int i = 0; i < 4; ++i ) { value |= static_cast(*(byte_array+i)) << 8*i; } } void from_byte_array(uint32 &value, const signed char* byte_array) { value = 0; for (unsigned int i = 0; i < 4; ++i ) { value |= static_cast(*(byte_array+i)) << 8*i; } } void from_byte_array(uint32 &value, const char* byte_array) { value = 0; for (unsigned int i = 0; i < 4; ++i ) { value |= static_cast(*(byte_array+i)) << 8*i; } } void from_byte_array(uint32 &value, const unsigned char* byte_array) { value = 0; for (unsigned int i = 0; i < 4; ++i ) { value |= static_cast(*(byte_array+i)) << 8*i; } } } // namespace ecl #endif /* ECL_CONVERTERS_LITE_BYTE_ARRAY_HPP_ */