bool3x2.gen.cs 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212
  1. //------------------------------------------------------------------------------
  2. // <auto-generated>
  3. // This code was generated by a tool.
  4. //
  5. // Changes to this file may cause incorrect behavior and will be lost if
  6. // the code is regenerated.
  7. // </auto-generated>
  8. //------------------------------------------------------------------------------
  9. using System;
  10. using System.Runtime.CompilerServices;
  11. #pragma warning disable 0660, 0661
  12. namespace Unity.Mathematics
  13. {
  14. [System.Serializable]
  15. public partial struct bool3x2 : System.IEquatable<bool3x2>
  16. {
  17. public bool3 c0;
  18. public bool3 c1;
  19. /// <summary>Constructs a bool3x2 matrix from two bool3 vectors.</summary>
  20. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  21. public bool3x2(bool3 c0, bool3 c1)
  22. {
  23. this.c0 = c0;
  24. this.c1 = c1;
  25. }
  26. /// <summary>Constructs a bool3x2 matrix from 6 bool values given in row-major order.</summary>
  27. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  28. public bool3x2(bool m00, bool m01,
  29. bool m10, bool m11,
  30. bool m20, bool m21)
  31. {
  32. this.c0 = new bool3(m00, m10, m20);
  33. this.c1 = new bool3(m01, m11, m21);
  34. }
  35. /// <summary>Constructs a bool3x2 matrix from a single bool value by assigning it to every component.</summary>
  36. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  37. public bool3x2(bool v)
  38. {
  39. this.c0 = v;
  40. this.c1 = v;
  41. }
  42. /// <summary>Implicitly converts a single bool value to a bool3x2 matrix by assigning it to every component.</summary>
  43. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  44. public static implicit operator bool3x2(bool v) { return new bool3x2(v); }
  45. /// <summary>Returns the result of a componentwise equality operation on two bool3x2 matrices.</summary>
  46. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  47. public static bool3x2 operator == (bool3x2 lhs, bool3x2 rhs) { return new bool3x2 (lhs.c0 == rhs.c0, lhs.c1 == rhs.c1); }
  48. /// <summary>Returns the result of a componentwise equality operation on a bool3x2 matrix and a bool value.</summary>
  49. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  50. public static bool3x2 operator == (bool3x2 lhs, bool rhs) { return new bool3x2 (lhs.c0 == rhs, lhs.c1 == rhs); }
  51. /// <summary>Returns the result of a componentwise equality operation on a bool value and a bool3x2 matrix.</summary>
  52. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  53. public static bool3x2 operator == (bool lhs, bool3x2 rhs) { return new bool3x2 (lhs == rhs.c0, lhs == rhs.c1); }
  54. /// <summary>Returns the result of a componentwise not equal operation on two bool3x2 matrices.</summary>
  55. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  56. public static bool3x2 operator != (bool3x2 lhs, bool3x2 rhs) { return new bool3x2 (lhs.c0 != rhs.c0, lhs.c1 != rhs.c1); }
  57. /// <summary>Returns the result of a componentwise not equal operation on a bool3x2 matrix and a bool value.</summary>
  58. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  59. public static bool3x2 operator != (bool3x2 lhs, bool rhs) { return new bool3x2 (lhs.c0 != rhs, lhs.c1 != rhs); }
  60. /// <summary>Returns the result of a componentwise not equal operation on a bool value and a bool3x2 matrix.</summary>
  61. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  62. public static bool3x2 operator != (bool lhs, bool3x2 rhs) { return new bool3x2 (lhs != rhs.c0, lhs != rhs.c1); }
  63. /// <summary>Returns the result of a componentwise not operation on a bool3x2 matrix.</summary>
  64. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  65. public static bool3x2 operator ! (bool3x2 val) { return new bool3x2 (!val.c0, !val.c1); }
  66. /// <summary>Returns the result of a componentwise bitwise and operation on two bool3x2 matrices.</summary>
  67. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  68. public static bool3x2 operator & (bool3x2 lhs, bool3x2 rhs) { return new bool3x2 (lhs.c0 & rhs.c0, lhs.c1 & rhs.c1); }
  69. /// <summary>Returns the result of a componentwise bitwise and operation on a bool3x2 matrix and a bool value.</summary>
  70. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  71. public static bool3x2 operator & (bool3x2 lhs, bool rhs) { return new bool3x2 (lhs.c0 & rhs, lhs.c1 & rhs); }
  72. /// <summary>Returns the result of a componentwise bitwise and operation on a bool value and a bool3x2 matrix.</summary>
  73. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  74. public static bool3x2 operator & (bool lhs, bool3x2 rhs) { return new bool3x2 (lhs & rhs.c0, lhs & rhs.c1); }
  75. /// <summary>Returns the result of a componentwise bitwise or operation on two bool3x2 matrices.</summary>
  76. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  77. public static bool3x2 operator | (bool3x2 lhs, bool3x2 rhs) { return new bool3x2 (lhs.c0 | rhs.c0, lhs.c1 | rhs.c1); }
  78. /// <summary>Returns the result of a componentwise bitwise or operation on a bool3x2 matrix and a bool value.</summary>
  79. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  80. public static bool3x2 operator | (bool3x2 lhs, bool rhs) { return new bool3x2 (lhs.c0 | rhs, lhs.c1 | rhs); }
  81. /// <summary>Returns the result of a componentwise bitwise or operation on a bool value and a bool3x2 matrix.</summary>
  82. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  83. public static bool3x2 operator | (bool lhs, bool3x2 rhs) { return new bool3x2 (lhs | rhs.c0, lhs | rhs.c1); }
  84. /// <summary>Returns the result of a componentwise bitwise exclusive or operation on two bool3x2 matrices.</summary>
  85. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  86. public static bool3x2 operator ^ (bool3x2 lhs, bool3x2 rhs) { return new bool3x2 (lhs.c0 ^ rhs.c0, lhs.c1 ^ rhs.c1); }
  87. /// <summary>Returns the result of a componentwise bitwise exclusive or operation on a bool3x2 matrix and a bool value.</summary>
  88. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  89. public static bool3x2 operator ^ (bool3x2 lhs, bool rhs) { return new bool3x2 (lhs.c0 ^ rhs, lhs.c1 ^ rhs); }
  90. /// <summary>Returns the result of a componentwise bitwise exclusive or operation on a bool value and a bool3x2 matrix.</summary>
  91. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  92. public static bool3x2 operator ^ (bool lhs, bool3x2 rhs) { return new bool3x2 (lhs ^ rhs.c0, lhs ^ rhs.c1); }
  93. /// <summary>Returns the bool3 element at a specified index.</summary>
  94. unsafe public ref bool3 this[int index]
  95. {
  96. get
  97. {
  98. #if ENABLE_UNITY_COLLECTIONS_CHECKS
  99. if ((uint)index >= 2)
  100. throw new System.ArgumentException("index must be between[0...1]");
  101. #endif
  102. fixed (bool3x2* array = &this) { return ref ((bool3*)array)[index]; }
  103. }
  104. }
  105. /// <summary>Returns true if the bool3x2 is equal to a given bool3x2, false otherwise.</summary>
  106. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  107. public bool Equals(bool3x2 rhs) { return c0.Equals(rhs.c0) && c1.Equals(rhs.c1); }
  108. /// <summary>Returns true if the bool3x2 is equal to a given bool3x2, false otherwise.</summary>
  109. public override bool Equals(object o) { return Equals((bool3x2)o); }
  110. /// <summary>Returns a hash code for the bool3x2.</summary>
  111. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  112. public override int GetHashCode() { return (int)math.hash(this); }
  113. /// <summary>Returns a string representation of the bool3x2.</summary>
  114. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  115. public override string ToString()
  116. {
  117. return string.Format("bool3x2({0}, {1}, {2}, {3}, {4}, {5})", c0.x, c1.x, c0.y, c1.y, c0.z, c1.z);
  118. }
  119. }
  120. public static partial class math
  121. {
  122. /// <summary>Returns a bool3x2 matrix constructed from two bool3 vectors.</summary>
  123. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  124. public static bool3x2 bool3x2(bool3 c0, bool3 c1) { return new bool3x2(c0, c1); }
  125. /// <summary>Returns a bool3x2 matrix constructed from from 6 bool values given in row-major order.</summary>
  126. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  127. public static bool3x2 bool3x2(bool m00, bool m01,
  128. bool m10, bool m11,
  129. bool m20, bool m21)
  130. {
  131. return new bool3x2(m00, m01,
  132. m10, m11,
  133. m20, m21);
  134. }
  135. /// <summary>Returns a bool3x2 matrix constructed from a single bool value by assigning it to every component.</summary>
  136. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  137. public static bool3x2 bool3x2(bool v) { return new bool3x2(v); }
  138. /// <summary>Return the bool2x3 transpose of a bool3x2 matrix.</summary>
  139. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  140. public static bool2x3 transpose(bool3x2 v)
  141. {
  142. return bool2x3(
  143. v.c0.x, v.c0.y, v.c0.z,
  144. v.c1.x, v.c1.y, v.c1.z);
  145. }
  146. /// <summary>Returns a uint hash code of a bool3x2 vector.</summary>
  147. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  148. public static uint hash(bool3x2 v)
  149. {
  150. return csum(select(uint3(0x9C9F0823u, 0x5A9CA13Bu, 0xAFCDD5EFu), uint3(0xA88D187Du, 0xCF6EBA1Du, 0x9D88E5A1u), v.c0) +
  151. select(uint3(0xEADF0775u, 0x747A9D7Bu, 0x4111F799u), uint3(0xB5F05AF1u, 0xFD80290Bu, 0x8B65ADB7u), v.c1));
  152. }
  153. /// <summary>
  154. /// Returns a uint3 vector hash code of a bool3x2 vector.
  155. /// When multiple elements are to be hashes together, it can more efficient to calculate and combine wide hash
  156. /// that are only reduced to a narrow uint hash at the very end instead of at every step.
  157. /// </summary>
  158. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  159. public static uint3 hashwide(bool3x2 v)
  160. {
  161. return (select(uint3(0xDFF4F563u, 0x7069770Du, 0xD1224537u), uint3(0xE99ED6F3u, 0x48125549u, 0xEEE2123Bu), v.c0) +
  162. select(uint3(0xE3AD9FE5u, 0xCE1CF8BFu, 0x7BE39F3Bu), uint3(0xFAB9913Fu, 0xB4501269u, 0xE04B89FDu), v.c1));
  163. }
  164. }
  165. }