bool2.gen.cs 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501
  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. using System.Runtime.InteropServices;
  12. using System.Diagnostics;
  13. #pragma warning disable 0660, 0661
  14. namespace Unity.Mathematics
  15. {
  16. [DebuggerTypeProxy(typeof(bool2.DebuggerProxy))]
  17. [System.Serializable]
  18. public partial struct bool2 : System.IEquatable<bool2>
  19. {
  20. [MarshalAs(UnmanagedType.U1)]
  21. public bool x;
  22. [MarshalAs(UnmanagedType.U1)]
  23. public bool y;
  24. /// <summary>Constructs a bool2 vector from two bool values.</summary>
  25. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  26. public bool2(bool x, bool y)
  27. {
  28. this.x = x;
  29. this.y = y;
  30. }
  31. /// <summary>Constructs a bool2 vector from a bool2 vector.</summary>
  32. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  33. public bool2(bool2 xy)
  34. {
  35. this.x = xy.x;
  36. this.y = xy.y;
  37. }
  38. /// <summary>Constructs a bool2 vector from a single bool value by assigning it to every component.</summary>
  39. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  40. public bool2(bool v)
  41. {
  42. this.x = v;
  43. this.y = v;
  44. }
  45. /// <summary>Implicitly converts a single bool value to a bool2 vector by assigning it to every component.</summary>
  46. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  47. public static implicit operator bool2(bool v) { return new bool2(v); }
  48. /// <summary>Returns the result of a componentwise equality operation on two bool2 vectors.</summary>
  49. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  50. public static bool2 operator == (bool2 lhs, bool2 rhs) { return new bool2 (lhs.x == rhs.x, lhs.y == rhs.y); }
  51. /// <summary>Returns the result of a componentwise equality operation on a bool2 vector and a bool value.</summary>
  52. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  53. public static bool2 operator == (bool2 lhs, bool rhs) { return new bool2 (lhs.x == rhs, lhs.y == rhs); }
  54. /// <summary>Returns the result of a componentwise equality operation on a bool value and a bool2 vector.</summary>
  55. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  56. public static bool2 operator == (bool lhs, bool2 rhs) { return new bool2 (lhs == rhs.x, lhs == rhs.y); }
  57. /// <summary>Returns the result of a componentwise not equal operation on two bool2 vectors.</summary>
  58. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  59. public static bool2 operator != (bool2 lhs, bool2 rhs) { return new bool2 (lhs.x != rhs.x, lhs.y != rhs.y); }
  60. /// <summary>Returns the result of a componentwise not equal operation on a bool2 vector and a bool value.</summary>
  61. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  62. public static bool2 operator != (bool2 lhs, bool rhs) { return new bool2 (lhs.x != rhs, lhs.y != rhs); }
  63. /// <summary>Returns the result of a componentwise not equal operation on a bool value and a bool2 vector.</summary>
  64. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  65. public static bool2 operator != (bool lhs, bool2 rhs) { return new bool2 (lhs != rhs.x, lhs != rhs.y); }
  66. /// <summary>Returns the result of a componentwise not operation on a bool2 vector.</summary>
  67. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  68. public static bool2 operator ! (bool2 val) { return new bool2 (!val.x, !val.y); }
  69. /// <summary>Returns the result of a componentwise bitwise and operation on two bool2 vectors.</summary>
  70. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  71. public static bool2 operator & (bool2 lhs, bool2 rhs) { return new bool2 (lhs.x & rhs.x, lhs.y & rhs.y); }
  72. /// <summary>Returns the result of a componentwise bitwise and operation on a bool2 vector and a bool value.</summary>
  73. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  74. public static bool2 operator & (bool2 lhs, bool rhs) { return new bool2 (lhs.x & rhs, lhs.y & rhs); }
  75. /// <summary>Returns the result of a componentwise bitwise and operation on a bool value and a bool2 vector.</summary>
  76. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  77. public static bool2 operator & (bool lhs, bool2 rhs) { return new bool2 (lhs & rhs.x, lhs & rhs.y); }
  78. /// <summary>Returns the result of a componentwise bitwise or operation on two bool2 vectors.</summary>
  79. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  80. public static bool2 operator | (bool2 lhs, bool2 rhs) { return new bool2 (lhs.x | rhs.x, lhs.y | rhs.y); }
  81. /// <summary>Returns the result of a componentwise bitwise or operation on a bool2 vector and a bool value.</summary>
  82. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  83. public static bool2 operator | (bool2 lhs, bool rhs) { return new bool2 (lhs.x | rhs, lhs.y | rhs); }
  84. /// <summary>Returns the result of a componentwise bitwise or operation on a bool value and a bool2 vector.</summary>
  85. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  86. public static bool2 operator | (bool lhs, bool2 rhs) { return new bool2 (lhs | rhs.x, lhs | rhs.y); }
  87. /// <summary>Returns the result of a componentwise bitwise exclusive or operation on two bool2 vectors.</summary>
  88. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  89. public static bool2 operator ^ (bool2 lhs, bool2 rhs) { return new bool2 (lhs.x ^ rhs.x, lhs.y ^ rhs.y); }
  90. /// <summary>Returns the result of a componentwise bitwise exclusive or operation on a bool2 vector and a bool value.</summary>
  91. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  92. public static bool2 operator ^ (bool2 lhs, bool rhs) { return new bool2 (lhs.x ^ rhs, lhs.y ^ rhs); }
  93. /// <summary>Returns the result of a componentwise bitwise exclusive or operation on a bool value and a bool2 vector.</summary>
  94. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  95. public static bool2 operator ^ (bool lhs, bool2 rhs) { return new bool2 (lhs ^ rhs.x, lhs ^ rhs.y); }
  96. [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
  97. public bool4 xxxx
  98. {
  99. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  100. get { return new bool4(x, x, x, x); }
  101. }
  102. [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
  103. public bool4 xxxy
  104. {
  105. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  106. get { return new bool4(x, x, x, y); }
  107. }
  108. [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
  109. public bool4 xxyx
  110. {
  111. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  112. get { return new bool4(x, x, y, x); }
  113. }
  114. [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
  115. public bool4 xxyy
  116. {
  117. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  118. get { return new bool4(x, x, y, y); }
  119. }
  120. [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
  121. public bool4 xyxx
  122. {
  123. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  124. get { return new bool4(x, y, x, x); }
  125. }
  126. [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
  127. public bool4 xyxy
  128. {
  129. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  130. get { return new bool4(x, y, x, y); }
  131. }
  132. [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
  133. public bool4 xyyx
  134. {
  135. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  136. get { return new bool4(x, y, y, x); }
  137. }
  138. [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
  139. public bool4 xyyy
  140. {
  141. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  142. get { return new bool4(x, y, y, y); }
  143. }
  144. [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
  145. public bool4 yxxx
  146. {
  147. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  148. get { return new bool4(y, x, x, x); }
  149. }
  150. [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
  151. public bool4 yxxy
  152. {
  153. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  154. get { return new bool4(y, x, x, y); }
  155. }
  156. [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
  157. public bool4 yxyx
  158. {
  159. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  160. get { return new bool4(y, x, y, x); }
  161. }
  162. [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
  163. public bool4 yxyy
  164. {
  165. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  166. get { return new bool4(y, x, y, y); }
  167. }
  168. [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
  169. public bool4 yyxx
  170. {
  171. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  172. get { return new bool4(y, y, x, x); }
  173. }
  174. [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
  175. public bool4 yyxy
  176. {
  177. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  178. get { return new bool4(y, y, x, y); }
  179. }
  180. [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
  181. public bool4 yyyx
  182. {
  183. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  184. get { return new bool4(y, y, y, x); }
  185. }
  186. [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
  187. public bool4 yyyy
  188. {
  189. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  190. get { return new bool4(y, y, y, y); }
  191. }
  192. [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
  193. public bool3 xxx
  194. {
  195. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  196. get { return new bool3(x, x, x); }
  197. }
  198. [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
  199. public bool3 xxy
  200. {
  201. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  202. get { return new bool3(x, x, y); }
  203. }
  204. [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
  205. public bool3 xyx
  206. {
  207. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  208. get { return new bool3(x, y, x); }
  209. }
  210. [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
  211. public bool3 xyy
  212. {
  213. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  214. get { return new bool3(x, y, y); }
  215. }
  216. [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
  217. public bool3 yxx
  218. {
  219. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  220. get { return new bool3(y, x, x); }
  221. }
  222. [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
  223. public bool3 yxy
  224. {
  225. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  226. get { return new bool3(y, x, y); }
  227. }
  228. [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
  229. public bool3 yyx
  230. {
  231. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  232. get { return new bool3(y, y, x); }
  233. }
  234. [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
  235. public bool3 yyy
  236. {
  237. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  238. get { return new bool3(y, y, y); }
  239. }
  240. [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
  241. public bool2 xx
  242. {
  243. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  244. get { return new bool2(x, x); }
  245. }
  246. [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
  247. public bool2 xy
  248. {
  249. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  250. get { return new bool2(x, y); }
  251. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  252. set { x = value.x; y = value.y; }
  253. }
  254. [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
  255. public bool2 yx
  256. {
  257. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  258. get { return new bool2(y, x); }
  259. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  260. set { y = value.x; x = value.y; }
  261. }
  262. [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
  263. public bool2 yy
  264. {
  265. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  266. get { return new bool2(y, y); }
  267. }
  268. /// <summary>Returns the bool element at a specified index.</summary>
  269. unsafe public bool this[int index]
  270. {
  271. get
  272. {
  273. #if ENABLE_UNITY_COLLECTIONS_CHECKS
  274. if ((uint)index >= 2)
  275. throw new System.ArgumentException("index must be between[0...1]");
  276. #endif
  277. fixed (bool2* array = &this) { return ((bool*)array)[index]; }
  278. }
  279. set
  280. {
  281. #if ENABLE_UNITY_COLLECTIONS_CHECKS
  282. if ((uint)index >= 2)
  283. throw new System.ArgumentException("index must be between[0...1]");
  284. #endif
  285. fixed (bool* array = &x) { array[index] = value; }
  286. }
  287. }
  288. /// <summary>Returns true if the bool2 is equal to a given bool2, false otherwise.</summary>
  289. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  290. public bool Equals(bool2 rhs) { return x == rhs.x && y == rhs.y; }
  291. /// <summary>Returns true if the bool2 is equal to a given bool2, false otherwise.</summary>
  292. public override bool Equals(object o) { return Equals((bool2)o); }
  293. /// <summary>Returns a hash code for the bool2.</summary>
  294. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  295. public override int GetHashCode() { return (int)math.hash(this); }
  296. /// <summary>Returns a string representation of the bool2.</summary>
  297. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  298. public override string ToString()
  299. {
  300. return string.Format("bool2({0}, {1})", x, y);
  301. }
  302. internal sealed class DebuggerProxy
  303. {
  304. public bool x;
  305. public bool y;
  306. public DebuggerProxy(bool2 v)
  307. {
  308. x = v.x;
  309. y = v.y;
  310. }
  311. }
  312. }
  313. public static partial class math
  314. {
  315. /// <summary>Returns a bool2 vector constructed from two bool values.</summary>
  316. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  317. public static bool2 bool2(bool x, bool y) { return new bool2(x, y); }
  318. /// <summary>Returns a bool2 vector constructed from a bool2 vector.</summary>
  319. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  320. public static bool2 bool2(bool2 xy) { return new bool2(xy); }
  321. /// <summary>Returns a bool2 vector constructed from a single bool value by assigning it to every component.</summary>
  322. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  323. public static bool2 bool2(bool v) { return new bool2(v); }
  324. /// <summary>Returns a uint hash code of a bool2 vector.</summary>
  325. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  326. public static uint hash(bool2 v)
  327. {
  328. return csum(select(uint2(0x90A285BBu, 0x5D19E1D5u), uint2(0xFAAF07DDu, 0x625C45BDu), v));
  329. }
  330. /// <summary>
  331. /// Returns a uint2 vector hash code of a bool2 vector.
  332. /// When multiple elements are to be hashes together, it can more efficient to calculate and combine wide hash
  333. /// that are only reduced to a narrow uint hash at the very end instead of at every step.
  334. /// </summary>
  335. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  336. public static uint2 hashwide(bool2 v)
  337. {
  338. return (select(uint2(0xC9F27FCBu, 0x6D2523B1u), uint2(0x6E2BF6A9u, 0xCC74B3B7u), v));
  339. }
  340. /// <summary>Returns the result of specified shuffling of the components from two bool2 vectors into a bool value.</summary>
  341. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  342. public static bool shuffle(bool2 a, bool2 b, ShuffleComponent x)
  343. {
  344. return select_shuffle_component(a, b, x);
  345. }
  346. /// <summary>Returns the result of specified shuffling of the components from two bool2 vectors into a bool2 vector.</summary>
  347. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  348. public static bool2 shuffle(bool2 a, bool2 b, ShuffleComponent x, ShuffleComponent y)
  349. {
  350. return bool2(
  351. select_shuffle_component(a, b, x),
  352. select_shuffle_component(a, b, y));
  353. }
  354. /// <summary>Returns the result of specified shuffling of the components from two bool2 vectors into a bool3 vector.</summary>
  355. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  356. public static bool3 shuffle(bool2 a, bool2 b, ShuffleComponent x, ShuffleComponent y, ShuffleComponent z)
  357. {
  358. return bool3(
  359. select_shuffle_component(a, b, x),
  360. select_shuffle_component(a, b, y),
  361. select_shuffle_component(a, b, z));
  362. }
  363. /// <summary>Returns the result of specified shuffling of the components from two bool2 vectors into a bool4 vector.</summary>
  364. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  365. public static bool4 shuffle(bool2 a, bool2 b, ShuffleComponent x, ShuffleComponent y, ShuffleComponent z, ShuffleComponent w)
  366. {
  367. return bool4(
  368. select_shuffle_component(a, b, x),
  369. select_shuffle_component(a, b, y),
  370. select_shuffle_component(a, b, z),
  371. select_shuffle_component(a, b, w));
  372. }
  373. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  374. internal static bool select_shuffle_component(bool2 a, bool2 b, ShuffleComponent component)
  375. {
  376. switch(component)
  377. {
  378. case ShuffleComponent.LeftX:
  379. return a.x;
  380. case ShuffleComponent.LeftY:
  381. return a.y;
  382. case ShuffleComponent.RightX:
  383. return b.x;
  384. case ShuffleComponent.RightY:
  385. return b.y;
  386. default:
  387. throw new System.ArgumentException("Invalid shuffle component: " + component);
  388. }
  389. }
  390. }
  391. }