Skip to content

Commit

Permalink
Block8x8 set explicit size instead of (unused) fixed sized buffer field
Browse files Browse the repository at this point in the history
  • Loading branch information
gfoidl committed Mar 26, 2023
1 parent a4ad7b0 commit 4532194
Showing 1 changed file with 2 additions and 13 deletions.
15 changes: 2 additions & 13 deletions src/ImageSharp/Formats/Jpeg/Components/Block8x8.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,25 +15,14 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.Components;
/// 8x8 matrix of <see cref="short"/> coefficients.
/// </summary>
// ReSharper disable once InconsistentNaming
[StructLayout(LayoutKind.Explicit)]
internal unsafe partial struct Block8x8
[StructLayout(LayoutKind.Explicit, Size = 2 * Size)]
internal partial struct Block8x8
{
/// <summary>
/// A number of scalar coefficients in a <see cref="Block8x8F"/>
/// </summary>
public const int Size = 64;

#pragma warning disable IDE0051 // Remove unused private member
/// <summary>
/// A placeholder buffer so the actual struct occupies exactly 64 * 2 bytes.
/// </summary>
/// <remarks>
/// This is not used directly in the code.
/// </remarks>
[FieldOffset(0)]
private fixed short data[Size];
#pragma warning restore IDE0051

/// <summary>
/// Gets or sets a <see cref="short"/> value at the given index
/// </summary>
Expand Down

0 comments on commit 4532194

Please sign in to comment.