@@ -10,6 +10,7 @@ public static int DecompressETC(ReadOnlySpan<byte> input, int width, int height,
1010
1111 public static int DecompressETC ( ReadOnlySpan < byte > input , int width , int height , Span < byte > output )
1212 {
13+ ThrowHelper . ThrowIfNotLittleEndian ( ) ;
1314 int requiredLength = ( ( width + 3 ) / 4 ) * ( ( height + 3 ) / 4 ) * 8 ;
1415 if ( input . Length < requiredLength )
1516 {
@@ -50,6 +51,7 @@ public static int DecompressETC2(ReadOnlySpan<byte> input, int width, int height
5051
5152 public static int DecompressETC2 ( ReadOnlySpan < byte > input , int width , int height , Span < byte > output )
5253 {
54+ ThrowHelper . ThrowIfNotLittleEndian ( ) ;
5355 int requiredLength = ( ( width + 3 ) / 4 ) * ( ( height + 3 ) / 4 ) * 8 ;
5456 if ( input . Length < requiredLength )
5557 {
@@ -90,6 +92,7 @@ public static int DecompressETC2A1(ReadOnlySpan<byte> input, int width, int heig
9092
9193 public static int DecompressETC2A1 ( ReadOnlySpan < byte > input , int width , int height , Span < byte > output )
9294 {
95+ ThrowHelper . ThrowIfNotLittleEndian ( ) ;
9396 int requiredLength = ( ( width + 3 ) / 4 ) * ( ( height + 3 ) / 4 ) * 8 ;
9497 if ( input . Length < requiredLength )
9598 {
@@ -130,6 +133,7 @@ public static int DecompressETC2A8(ReadOnlySpan<byte> input, int width, int heig
130133
131134 public static int DecompressETC2A8 ( ReadOnlySpan < byte > input , int width , int height , Span < byte > output )
132135 {
136+ ThrowHelper . ThrowIfNotLittleEndian ( ) ;
133137 int requiredLength = ( ( width + 3 ) / 4 ) * ( ( height + 3 ) / 4 ) * 16 ;
134138 if ( input . Length < requiredLength )
135139 {
@@ -171,6 +175,7 @@ public static int DecompressEACRUnsigned(ReadOnlySpan<byte> input, int width, in
171175
172176 public static int DecompressEACRUnsigned ( ReadOnlySpan < byte > input , int width , int height , Span < byte > output )
173177 {
178+ ThrowHelper . ThrowIfNotLittleEndian ( ) ;
174179 int requiredLength = ( ( width + 3 ) / 4 ) * ( ( height + 3 ) / 4 ) * 8 ;
175180 if ( input . Length < requiredLength )
176181 {
@@ -215,6 +220,7 @@ public static int DecompressEACRSigned(ReadOnlySpan<byte> input, int width, int
215220
216221 public static int DecompressEACRSigned ( ReadOnlySpan < byte > input , int width , int height , Span < byte > output )
217222 {
223+ ThrowHelper . ThrowIfNotLittleEndian ( ) ;
218224 int requiredLength = ( ( width + 3 ) / 4 ) * ( ( height + 3 ) / 4 ) * 8 ;
219225 if ( input . Length < requiredLength )
220226 {
@@ -259,6 +265,7 @@ public static int DecompressEACRGUnsigned(ReadOnlySpan<byte> input, int width, i
259265
260266 public static int DecompressEACRGUnsigned ( ReadOnlySpan < byte > input , int width , int height , Span < byte > output )
261267 {
268+ ThrowHelper . ThrowIfNotLittleEndian ( ) ;
262269 int bcw = ( width + 3 ) / 4 ;
263270 int bch = ( height + 3 ) / 4 ;
264271
@@ -304,6 +311,7 @@ public static int DecompressEACRGSigned(ReadOnlySpan<byte> input, int width, int
304311
305312 public static int DecompressEACRGSigned ( ReadOnlySpan < byte > input , int width , int height , Span < byte > output )
306313 {
314+ ThrowHelper . ThrowIfNotLittleEndian ( ) ;
307315 int requiredLength = ( ( width + 3 ) / 4 ) * ( ( height + 3 ) / 4 ) * 16 ;
308316 if ( input . Length < requiredLength )
309317 {
@@ -741,6 +749,7 @@ private static void DecodeEtc2PunchThrowBlock(ReadOnlySpan<byte> input, Span<uin
741749
742750 private static void DecodeEtc2a8Block ( ReadOnlySpan < byte > input , Span < uint > output )
743751 {
752+ ThrowHelper . ThrowIfNotLittleEndian ( ) ;
744753 int @base = input [ 0 ] ;
745754 int data1 = input [ 1 ] ;
746755 int mul = data1 >> 4 ;
@@ -761,6 +770,7 @@ private static void DecodeEtc2a8Block(ReadOnlySpan<byte> input, Span<uint> outpu
761770
762771 private static void DecodeEacUnsignedBlock ( ReadOnlySpan < byte > input , Span < uint > output , int channel )
763772 {
773+ ThrowHelper . ThrowIfNotLittleEndian ( ) ;
764774 int @base = input [ 0 ] ;
765775 int data1 = input [ 1 ] ;
766776 int mul = data1 >> 4 ;
@@ -778,6 +788,7 @@ private static void DecodeEacUnsignedBlock(ReadOnlySpan<byte> input, Span<uint>
778788
779789 private static void DecodeEacSignedBlock ( ReadOnlySpan < byte > input , Span < uint > output , int channel )
780790 {
791+ ThrowHelper . ThrowIfNotLittleEndian ( ) ;
781792 int @base = 127 + unchecked ( ( sbyte ) input [ 0 ] ) ;
782793 int data1 = input [ 1 ] ;
783794 int mul = data1 >> 4 ;
0 commit comments