📷 A modern, cross-platform, 2D Graphics library for .NET
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

24 lines
611 B

// Copyright (c) Six Labors.
// Licensed under the Six Labors Split License.
namespace SixLabors.ImageSharp.Tests.TestUtilities;
using System;
public static class ByteArrayUtility
{
public static byte[] WithByteOrder(this byte[] bytes, bool isLittleEndian)
{
if (isLittleEndian != BitConverter.IsLittleEndian)
{
byte[] reversedBytes = new byte[bytes.Length];
Array.Copy(bytes, reversedBytes, bytes.Length);
Array.Reverse(reversedBytes);
return reversedBytes;
}
else
{
return bytes;
}
}
}