-inline void istream_read_big_endian(InputStreamType& istream, Type& value)
-{
- istream.read(reinterpret_cast<typename InputStreamType::byte_type*>(&value), sizeof(Type));
-#if !defined(__BIG_ENDIAN__)
- std::reverse(reinterpret_cast<typename InputStreamType::byte_type*>(&value), reinterpret_cast<typename InputStreamType::byte_type*>(&value) + sizeof(Type));
-#endif
+inline void istream_read_big_endian( InputStreamType& istream, Type& value ){
+ istream.read(reinterpret_cast<typename InputStreamType::byte_type *>( &value ), sizeof(Type));
+ if (!GDEF_ARCH_ENDIAN_BIG) {
+ std::reverse(reinterpret_cast<typename InputStreamType::byte_type *>( &value ),
+ reinterpret_cast<typename InputStreamType::byte_type *>( &value ) + sizeof(Type));
+ }
+}
+
+template<typename InputStreamType>
+inline void istream_read_byte( InputStreamType& istream, typename InputStreamType::byte_type& b ){
+ istream.read( &b, 1 );
+}
+
+
+template<typename InputStreamType>
+inline int16_t istream_read_int16_le( InputStreamType& istream ){
+ int16_t value;
+ istream_read_little_endian( istream, value );
+ return value;