Brak opisu
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.

AssumeRangeAttribute.cs 1.2KB

12345678910111213141516171819202122232425262728293031
  1. using System;
  2. namespace Unity.Burst.CompilerServices
  3. {
  4. /// <summary>
  5. /// Can be used to specify that a parameter or return has a range assumption.
  6. /// Assumptions feed directly into the optimizer and allow better codegen.
  7. ///
  8. /// Only usable on values of type scalar integer.
  9. ///
  10. /// The range is a closed interval [min..max] - EG. the attributed value
  11. /// is greater-than-or-equal-to min and less-than-or-equal-to max.
  12. /// </summary>
  13. [AttributeUsage(AttributeTargets.ReturnValue | AttributeTargets.Parameter)]
  14. public class AssumeRangeAttribute : Attribute
  15. {
  16. /// <summary>
  17. /// Assume that an integer is in the signed closed interval [min..max].
  18. /// </summary>
  19. /// <param name="min">The inclusive minimum value.</param>
  20. /// <param name="max">The inclusive maximum value.</param>
  21. public AssumeRangeAttribute(long min, long max) { }
  22. /// <summary>
  23. /// Assume that an integer is in the unsigned closed interval [min..max].
  24. /// </summary>
  25. /// <param name="min">The inclusive minimum value.</param>
  26. /// <param name="max">The inclusive maximum value.</param>
  27. public AssumeRangeAttribute(ulong min, ulong max) { }
  28. }
  29. }