KTX support - something Git didn't want to commit
[xonotic/netradiant.git] / libs / bytestreamutils.h
index 156333a..90a9048 100644 (file)
@@ -83,6 +83,13 @@ inline int16_t istream_read_int16_le( InputStreamType& istream ){
 }
 
 template<typename InputStreamType>
+inline int16_t istream_read_int16_be( InputStreamType& istream ){
+       int16_t value;
+       istream_read_big_endian( istream, value );
+       return value;
+}
+
+template<typename InputStreamType>
 inline uint16_t istream_read_uint16_le( InputStreamType& istream ){
        uint16_t value;
        istream_read_little_endian( istream, value );
@@ -90,6 +97,13 @@ inline uint16_t istream_read_uint16_le( InputStreamType& istream ){
 }
 
 template<typename InputStreamType>
+inline uint16_t istream_read_uint16_be( InputStreamType& istream ){
+       uint16_t value;
+       istream_read_big_endian( istream, value );
+       return value;
+}
+
+template<typename InputStreamType>
 inline int32_t istream_read_int32_le( InputStreamType& istream ){
        int32_t value;
        istream_read_little_endian( istream, value );
@@ -97,6 +111,13 @@ inline int32_t istream_read_int32_le( InputStreamType& istream ){
 }
 
 template<typename InputStreamType>
+inline int32_t istream_read_int32_be( InputStreamType& istream ){
+       int32_t value;
+       istream_read_big_endian( istream, value );
+       return value;
+}
+
+template<typename InputStreamType>
 inline uint32_t istream_read_uint32_le( InputStreamType& istream ){
        uint32_t value;
        istream_read_little_endian( istream, value );
@@ -104,6 +125,13 @@ inline uint32_t istream_read_uint32_le( InputStreamType& istream ){
 }
 
 template<typename InputStreamType>
+inline uint32_t istream_read_uint32_be( InputStreamType& istream ){
+       uint32_t value;
+       istream_read_big_endian( istream, value );
+       return value;
+}
+
+template<typename InputStreamType>
 inline float istream_read_float32_le( InputStreamType& istream ){
        float value;
        istream_read_little_endian( istream, value );
@@ -111,6 +139,13 @@ inline float istream_read_float32_le( InputStreamType& istream ){
 }
 
 template<typename InputStreamType>
+inline float istream_read_float32_be( InputStreamType& istream ){
+       float value;
+       istream_read_big_endian( istream, value );
+       return value;
+}
+
+template<typename InputStreamType>
 inline typename InputStreamType::byte_type istream_read_byte( InputStreamType& istream ){
        typename InputStreamType::byte_type b;
        istream.read( &b, sizeof( typename InputStreamType::byte_type ) );