📷 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.
 
 

25 lines
685 B

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