Padding.cs 854 B

1234567891011121314151617181920212223242526
  1. // Licensed to the .NET Foundation under one or more agreements.
  2. // The .NET Foundation licenses this file to you under the MIT license.
  3. // See the LICENSE file in the project root for more information.
  4. using System.Runtime.InteropServices;
  5. namespace Internal
  6. {
  7. /// <summary>A class for common padding constants and eventually routines.</summary>
  8. internal static class PaddingHelpers
  9. {
  10. /// <summary>A size greater than or equal to the size of the most common CPU cache lines.</summary>
  11. #if ARM64
  12. internal const int CACHE_LINE_SIZE = 128;
  13. #else
  14. internal const int CACHE_LINE_SIZE = 64;
  15. #endif
  16. }
  17. /// <summary>Padding structure used to minimize false sharing</summary>
  18. [StructLayout(LayoutKind.Explicit, Size = PaddingHelpers.CACHE_LINE_SIZE - sizeof(int))]
  19. internal struct PaddingFor32
  20. {
  21. }
  22. }