Aucune description
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

bool2x2.gen.cs 17KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292
  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. To update the generation of this file, modify and re-run Unity.Mathematics.CodeGen.
  7. // </auto-generated>
  8. //------------------------------------------------------------------------------
  9. using System;
  10. using System.Runtime.CompilerServices;
  11. using Unity.IL2CPP.CompilerServices;
  12. #pragma warning disable 0660, 0661
  13. namespace Unity.Mathematics
  14. {
  15. /// <summary>A 2x2 matrix of bools.</summary>
  16. [System.Serializable]
  17. [Il2CppEagerStaticClassConstruction]
  18. public partial struct bool2x2 : System.IEquatable<bool2x2>
  19. {
  20. /// <summary>Column 0 of the matrix.</summary>
  21. public bool2 c0;
  22. /// <summary>Column 1 of the matrix.</summary>
  23. public bool2 c1;
  24. /// <summary>Constructs a bool2x2 matrix from two bool2 vectors.</summary>
  25. /// <param name="c0">The matrix column c0 will be set to this value.</param>
  26. /// <param name="c1">The matrix column c1 will be set to this value.</param>
  27. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  28. public bool2x2(bool2 c0, bool2 c1)
  29. {
  30. this.c0 = c0;
  31. this.c1 = c1;
  32. }
  33. /// <summary>Constructs a bool2x2 matrix from 4 bool values given in row-major order.</summary>
  34. /// <param name="m00">The matrix at row 0, column 0 will be set to this value.</param>
  35. /// <param name="m01">The matrix at row 0, column 1 will be set to this value.</param>
  36. /// <param name="m10">The matrix at row 1, column 0 will be set to this value.</param>
  37. /// <param name="m11">The matrix at row 1, column 1 will be set to this value.</param>
  38. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  39. public bool2x2(bool m00, bool m01,
  40. bool m10, bool m11)
  41. {
  42. this.c0 = new bool2(m00, m10);
  43. this.c1 = new bool2(m01, m11);
  44. }
  45. /// <summary>Constructs a bool2x2 matrix from a single bool value by assigning it to every component.</summary>
  46. /// <param name="v">bool to convert to bool2x2</param>
  47. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  48. public bool2x2(bool v)
  49. {
  50. this.c0 = v;
  51. this.c1 = v;
  52. }
  53. /// <summary>Implicitly converts a single bool value to a bool2x2 matrix by assigning it to every component.</summary>
  54. /// <param name="v">bool to convert to bool2x2</param>
  55. /// <returns>Converted value.</returns>
  56. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  57. public static implicit operator bool2x2(bool v) { return new bool2x2(v); }
  58. /// <summary>Returns the result of a componentwise equality operation on two bool2x2 matrices.</summary>
  59. /// <param name="lhs">Left hand side bool2x2 to use to compute componentwise equality.</param>
  60. /// <param name="rhs">Right hand side bool2x2 to use to compute componentwise equality.</param>
  61. /// <returns>bool2x2 result of the componentwise equality.</returns>
  62. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  63. public static bool2x2 operator == (bool2x2 lhs, bool2x2 rhs) { return new bool2x2 (lhs.c0 == rhs.c0, lhs.c1 == rhs.c1); }
  64. /// <summary>Returns the result of a componentwise equality operation on a bool2x2 matrix and a bool value.</summary>
  65. /// <param name="lhs">Left hand side bool2x2 to use to compute componentwise equality.</param>
  66. /// <param name="rhs">Right hand side bool to use to compute componentwise equality.</param>
  67. /// <returns>bool2x2 result of the componentwise equality.</returns>
  68. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  69. public static bool2x2 operator == (bool2x2 lhs, bool rhs) { return new bool2x2 (lhs.c0 == rhs, lhs.c1 == rhs); }
  70. /// <summary>Returns the result of a componentwise equality operation on a bool value and a bool2x2 matrix.</summary>
  71. /// <param name="lhs">Left hand side bool to use to compute componentwise equality.</param>
  72. /// <param name="rhs">Right hand side bool2x2 to use to compute componentwise equality.</param>
  73. /// <returns>bool2x2 result of the componentwise equality.</returns>
  74. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  75. public static bool2x2 operator == (bool lhs, bool2x2 rhs) { return new bool2x2 (lhs == rhs.c0, lhs == rhs.c1); }
  76. /// <summary>Returns the result of a componentwise not equal operation on two bool2x2 matrices.</summary>
  77. /// <param name="lhs">Left hand side bool2x2 to use to compute componentwise not equal.</param>
  78. /// <param name="rhs">Right hand side bool2x2 to use to compute componentwise not equal.</param>
  79. /// <returns>bool2x2 result of the componentwise not equal.</returns>
  80. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  81. public static bool2x2 operator != (bool2x2 lhs, bool2x2 rhs) { return new bool2x2 (lhs.c0 != rhs.c0, lhs.c1 != rhs.c1); }
  82. /// <summary>Returns the result of a componentwise not equal operation on a bool2x2 matrix and a bool value.</summary>
  83. /// <param name="lhs">Left hand side bool2x2 to use to compute componentwise not equal.</param>
  84. /// <param name="rhs">Right hand side bool to use to compute componentwise not equal.</param>
  85. /// <returns>bool2x2 result of the componentwise not equal.</returns>
  86. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  87. public static bool2x2 operator != (bool2x2 lhs, bool rhs) { return new bool2x2 (lhs.c0 != rhs, lhs.c1 != rhs); }
  88. /// <summary>Returns the result of a componentwise not equal operation on a bool value and a bool2x2 matrix.</summary>
  89. /// <param name="lhs">Left hand side bool to use to compute componentwise not equal.</param>
  90. /// <param name="rhs">Right hand side bool2x2 to use to compute componentwise not equal.</param>
  91. /// <returns>bool2x2 result of the componentwise not equal.</returns>
  92. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  93. public static bool2x2 operator != (bool lhs, bool2x2 rhs) { return new bool2x2 (lhs != rhs.c0, lhs != rhs.c1); }
  94. /// <summary>Returns the result of a componentwise not operation on a bool2x2 matrix.</summary>
  95. /// <param name="val">Value to use when computing the componentwise not.</param>
  96. /// <returns>bool2x2 result of the componentwise not.</returns>
  97. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  98. public static bool2x2 operator ! (bool2x2 val) { return new bool2x2 (!val.c0, !val.c1); }
  99. /// <summary>Returns the result of a componentwise bitwise and operation on two bool2x2 matrices.</summary>
  100. /// <param name="lhs">Left hand side bool2x2 to use to compute componentwise bitwise and.</param>
  101. /// <param name="rhs">Right hand side bool2x2 to use to compute componentwise bitwise and.</param>
  102. /// <returns>bool2x2 result of the componentwise bitwise and.</returns>
  103. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  104. public static bool2x2 operator & (bool2x2 lhs, bool2x2 rhs) { return new bool2x2 (lhs.c0 & rhs.c0, lhs.c1 & rhs.c1); }
  105. /// <summary>Returns the result of a componentwise bitwise and operation on a bool2x2 matrix and a bool value.</summary>
  106. /// <param name="lhs">Left hand side bool2x2 to use to compute componentwise bitwise and.</param>
  107. /// <param name="rhs">Right hand side bool to use to compute componentwise bitwise and.</param>
  108. /// <returns>bool2x2 result of the componentwise bitwise and.</returns>
  109. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  110. public static bool2x2 operator & (bool2x2 lhs, bool rhs) { return new bool2x2 (lhs.c0 & rhs, lhs.c1 & rhs); }
  111. /// <summary>Returns the result of a componentwise bitwise and operation on a bool value and a bool2x2 matrix.</summary>
  112. /// <param name="lhs">Left hand side bool to use to compute componentwise bitwise and.</param>
  113. /// <param name="rhs">Right hand side bool2x2 to use to compute componentwise bitwise and.</param>
  114. /// <returns>bool2x2 result of the componentwise bitwise and.</returns>
  115. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  116. public static bool2x2 operator & (bool lhs, bool2x2 rhs) { return new bool2x2 (lhs & rhs.c0, lhs & rhs.c1); }
  117. /// <summary>Returns the result of a componentwise bitwise or operation on two bool2x2 matrices.</summary>
  118. /// <param name="lhs">Left hand side bool2x2 to use to compute componentwise bitwise or.</param>
  119. /// <param name="rhs">Right hand side bool2x2 to use to compute componentwise bitwise or.</param>
  120. /// <returns>bool2x2 result of the componentwise bitwise or.</returns>
  121. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  122. public static bool2x2 operator | (bool2x2 lhs, bool2x2 rhs) { return new bool2x2 (lhs.c0 | rhs.c0, lhs.c1 | rhs.c1); }
  123. /// <summary>Returns the result of a componentwise bitwise or operation on a bool2x2 matrix and a bool value.</summary>
  124. /// <param name="lhs">Left hand side bool2x2 to use to compute componentwise bitwise or.</param>
  125. /// <param name="rhs">Right hand side bool to use to compute componentwise bitwise or.</param>
  126. /// <returns>bool2x2 result of the componentwise bitwise or.</returns>
  127. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  128. public static bool2x2 operator | (bool2x2 lhs, bool rhs) { return new bool2x2 (lhs.c0 | rhs, lhs.c1 | rhs); }
  129. /// <summary>Returns the result of a componentwise bitwise or operation on a bool value and a bool2x2 matrix.</summary>
  130. /// <param name="lhs">Left hand side bool to use to compute componentwise bitwise or.</param>
  131. /// <param name="rhs">Right hand side bool2x2 to use to compute componentwise bitwise or.</param>
  132. /// <returns>bool2x2 result of the componentwise bitwise or.</returns>
  133. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  134. public static bool2x2 operator | (bool lhs, bool2x2 rhs) { return new bool2x2 (lhs | rhs.c0, lhs | rhs.c1); }
  135. /// <summary>Returns the result of a componentwise bitwise exclusive or operation on two bool2x2 matrices.</summary>
  136. /// <param name="lhs">Left hand side bool2x2 to use to compute componentwise bitwise exclusive or.</param>
  137. /// <param name="rhs">Right hand side bool2x2 to use to compute componentwise bitwise exclusive or.</param>
  138. /// <returns>bool2x2 result of the componentwise bitwise exclusive or.</returns>
  139. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  140. public static bool2x2 operator ^ (bool2x2 lhs, bool2x2 rhs) { return new bool2x2 (lhs.c0 ^ rhs.c0, lhs.c1 ^ rhs.c1); }
  141. /// <summary>Returns the result of a componentwise bitwise exclusive or operation on a bool2x2 matrix and a bool value.</summary>
  142. /// <param name="lhs">Left hand side bool2x2 to use to compute componentwise bitwise exclusive or.</param>
  143. /// <param name="rhs">Right hand side bool to use to compute componentwise bitwise exclusive or.</param>
  144. /// <returns>bool2x2 result of the componentwise bitwise exclusive or.</returns>
  145. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  146. public static bool2x2 operator ^ (bool2x2 lhs, bool rhs) { return new bool2x2 (lhs.c0 ^ rhs, lhs.c1 ^ rhs); }
  147. /// <summary>Returns the result of a componentwise bitwise exclusive or operation on a bool value and a bool2x2 matrix.</summary>
  148. /// <param name="lhs">Left hand side bool to use to compute componentwise bitwise exclusive or.</param>
  149. /// <param name="rhs">Right hand side bool2x2 to use to compute componentwise bitwise exclusive or.</param>
  150. /// <returns>bool2x2 result of the componentwise bitwise exclusive or.</returns>
  151. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  152. public static bool2x2 operator ^ (bool lhs, bool2x2 rhs) { return new bool2x2 (lhs ^ rhs.c0, lhs ^ rhs.c1); }
  153. /// <summary>Returns the bool2 element at a specified index.</summary>
  154. unsafe public ref bool2 this[int index]
  155. {
  156. get
  157. {
  158. #if ENABLE_UNITY_COLLECTIONS_CHECKS
  159. if ((uint)index >= 2)
  160. throw new System.ArgumentException("index must be between[0...1]");
  161. #endif
  162. fixed (bool2x2* array = &this) { return ref ((bool2*)array)[index]; }
  163. }
  164. }
  165. /// <summary>Returns true if the bool2x2 is equal to a given bool2x2, false otherwise.</summary>
  166. /// <param name="rhs">Right hand side argument to compare equality with.</param>
  167. /// <returns>The result of the equality comparison.</returns>
  168. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  169. public bool Equals(bool2x2 rhs) { return c0.Equals(rhs.c0) && c1.Equals(rhs.c1); }
  170. /// <summary>Returns true if the bool2x2 is equal to a given bool2x2, false otherwise.</summary>
  171. /// <param name="o">Right hand side argument to compare equality with.</param>
  172. /// <returns>The result of the equality comparison.</returns>
  173. public override bool Equals(object o) { return o is bool2x2 converted && Equals(converted); }
  174. /// <summary>Returns a hash code for the bool2x2.</summary>
  175. /// <returns>The computed hash code.</returns>
  176. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  177. public override int GetHashCode() { return (int)math.hash(this); }
  178. /// <summary>Returns a string representation of the bool2x2.</summary>
  179. /// <returns>String representation of the value.</returns>
  180. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  181. public override string ToString()
  182. {
  183. return string.Format("bool2x2({0}, {1}, {2}, {3})", c0.x, c1.x, c0.y, c1.y);
  184. }
  185. }
  186. public static partial class math
  187. {
  188. /// <summary>Returns a bool2x2 matrix constructed from two bool2 vectors.</summary>
  189. /// <param name="c0">The matrix column c0 will be set to this value.</param>
  190. /// <param name="c1">The matrix column c1 will be set to this value.</param>
  191. /// <returns>bool2x2 constructed from arguments.</returns>
  192. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  193. public static bool2x2 bool2x2(bool2 c0, bool2 c1) { return new bool2x2(c0, c1); }
  194. /// <summary>Returns a bool2x2 matrix constructed from from 4 bool values given in row-major order.</summary>
  195. /// <param name="m00">The matrix at row 0, column 0 will be set to this value.</param>
  196. /// <param name="m01">The matrix at row 0, column 1 will be set to this value.</param>
  197. /// <param name="m10">The matrix at row 1, column 0 will be set to this value.</param>
  198. /// <param name="m11">The matrix at row 1, column 1 will be set to this value.</param>
  199. /// <returns>bool2x2 constructed from arguments.</returns>
  200. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  201. public static bool2x2 bool2x2(bool m00, bool m01,
  202. bool m10, bool m11)
  203. {
  204. return new bool2x2(m00, m01,
  205. m10, m11);
  206. }
  207. /// <summary>Returns a bool2x2 matrix constructed from a single bool value by assigning it to every component.</summary>
  208. /// <param name="v">bool to convert to bool2x2</param>
  209. /// <returns>Converted value.</returns>
  210. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  211. public static bool2x2 bool2x2(bool v) { return new bool2x2(v); }
  212. /// <summary>Return the bool2x2 transpose of a bool2x2 matrix.</summary>
  213. /// <param name="v">Value to transpose.</param>
  214. /// <returns>Transposed value.</returns>
  215. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  216. public static bool2x2 transpose(bool2x2 v)
  217. {
  218. return bool2x2(
  219. v.c0.x, v.c0.y,
  220. v.c1.x, v.c1.y);
  221. }
  222. /// <summary>Returns a uint hash code of a bool2x2 matrix.</summary>
  223. /// <param name="v">Matrix value to hash.</param>
  224. /// <returns>uint hash of the argument.</returns>
  225. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  226. public static uint hash(bool2x2 v)
  227. {
  228. return csum(select(uint2(0x7AF32C49u, 0xAE131389u), uint2(0x5D1B165Bu, 0x87096CD7u), v.c0) +
  229. select(uint2(0x4C7F6DD1u, 0x4822A3E9u), uint2(0xAAC3C25Du, 0xD21D0945u), v.c1));
  230. }
  231. /// <summary>
  232. /// Returns a uint2 vector hash code of a bool2x2 matrix.
  233. /// When multiple elements are to be hashes together, it can more efficient to calculate and combine wide hash
  234. /// that are only reduced to a narrow uint hash at the very end instead of at every step.
  235. /// </summary>
  236. /// <param name="v">Matrix value to hash.</param>
  237. /// <returns>uint2 hash of the argument.</returns>
  238. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  239. public static uint2 hashwide(bool2x2 v)
  240. {
  241. return (select(uint2(0x88FCAB2Du, 0x614DA60Du), uint2(0x5BA2C50Bu, 0x8C455ACBu), v.c0) +
  242. select(uint2(0xCD266C89u, 0xF1852A33u), uint2(0x77E35E77u, 0x863E3729u), v.c1));
  243. }
  244. }
  245. }