Ingen beskrivning
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.

half2.gen.cs 24KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569
  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 System.Diagnostics;
  12. using Unity.IL2CPP.CompilerServices;
  13. #pragma warning disable 0660, 0661
  14. namespace Unity.Mathematics
  15. {
  16. /// <summary>A 2 component vector of halfs.</summary>
  17. [DebuggerTypeProxy(typeof(half2.DebuggerProxy))]
  18. [System.Serializable]
  19. [Il2CppEagerStaticClassConstruction]
  20. public partial struct half2 : System.IEquatable<half2>, IFormattable
  21. {
  22. /// <summary>x component of the vector.</summary>
  23. public half x;
  24. /// <summary>y component of the vector.</summary>
  25. public half y;
  26. /// <summary>half2 zero value.</summary>
  27. public static readonly half2 zero;
  28. /// <summary>Constructs a half2 vector from two half values.</summary>
  29. /// <param name="x">The constructed vector's x component will be set to this value.</param>
  30. /// <param name="y">The constructed vector's y component will be set to this value.</param>
  31. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  32. public half2(half x, half y)
  33. {
  34. this.x = x;
  35. this.y = y;
  36. }
  37. /// <summary>Constructs a half2 vector from a half2 vector.</summary>
  38. /// <param name="xy">The constructed vector's xy components will be set to this value.</param>
  39. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  40. public half2(half2 xy)
  41. {
  42. this.x = xy.x;
  43. this.y = xy.y;
  44. }
  45. /// <summary>Constructs a half2 vector from a single half value by assigning it to every component.</summary>
  46. /// <param name="v">half to convert to half2</param>
  47. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  48. public half2(half v)
  49. {
  50. this.x = v;
  51. this.y = v;
  52. }
  53. /// <summary>Constructs a half2 vector from a single float value by converting it to half and assigning it to every component.</summary>
  54. /// <param name="v">float to convert to half2</param>
  55. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  56. public half2(float v)
  57. {
  58. this.x = (half)v;
  59. this.y = (half)v;
  60. }
  61. /// <summary>Constructs a half2 vector from a float2 vector by componentwise conversion.</summary>
  62. /// <param name="v">float2 to convert to half2</param>
  63. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  64. public half2(float2 v)
  65. {
  66. this.x = (half)v.x;
  67. this.y = (half)v.y;
  68. }
  69. /// <summary>Constructs a half2 vector from a single double value by converting it to half and assigning it to every component.</summary>
  70. /// <param name="v">double to convert to half2</param>
  71. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  72. public half2(double v)
  73. {
  74. this.x = (half)v;
  75. this.y = (half)v;
  76. }
  77. /// <summary>Constructs a half2 vector from a double2 vector by componentwise conversion.</summary>
  78. /// <param name="v">double2 to convert to half2</param>
  79. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  80. public half2(double2 v)
  81. {
  82. this.x = (half)v.x;
  83. this.y = (half)v.y;
  84. }
  85. /// <summary>Implicitly converts a single half value to a half2 vector by assigning it to every component.</summary>
  86. /// <param name="v">half to convert to half2</param>
  87. /// <returns>Converted value.</returns>
  88. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  89. public static implicit operator half2(half v) { return new half2(v); }
  90. /// <summary>Explicitly converts a single float value to a half2 vector by converting it to half and assigning it to every component.</summary>
  91. /// <param name="v">float to convert to half2</param>
  92. /// <returns>Converted value.</returns>
  93. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  94. public static explicit operator half2(float v) { return new half2(v); }
  95. /// <summary>Explicitly converts a float2 vector to a half2 vector by componentwise conversion.</summary>
  96. /// <param name="v">float2 to convert to half2</param>
  97. /// <returns>Converted value.</returns>
  98. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  99. public static explicit operator half2(float2 v) { return new half2(v); }
  100. /// <summary>Explicitly converts a single double value to a half2 vector by converting it to half and assigning it to every component.</summary>
  101. /// <param name="v">double to convert to half2</param>
  102. /// <returns>Converted value.</returns>
  103. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  104. public static explicit operator half2(double v) { return new half2(v); }
  105. /// <summary>Explicitly converts a double2 vector to a half2 vector by componentwise conversion.</summary>
  106. /// <param name="v">double2 to convert to half2</param>
  107. /// <returns>Converted value.</returns>
  108. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  109. public static explicit operator half2(double2 v) { return new half2(v); }
  110. /// <summary>Returns the result of a componentwise equality operation on two half2 vectors.</summary>
  111. /// <param name="lhs">Left hand side half2 to use to compute componentwise equality.</param>
  112. /// <param name="rhs">Right hand side half2 to use to compute componentwise equality.</param>
  113. /// <returns>bool2 result of the componentwise equality.</returns>
  114. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  115. public static bool2 operator == (half2 lhs, half2 rhs) { return new bool2 (lhs.x == rhs.x, lhs.y == rhs.y); }
  116. /// <summary>Returns the result of a componentwise equality operation on a half2 vector and a half value.</summary>
  117. /// <param name="lhs">Left hand side half2 to use to compute componentwise equality.</param>
  118. /// <param name="rhs">Right hand side half to use to compute componentwise equality.</param>
  119. /// <returns>bool2 result of the componentwise equality.</returns>
  120. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  121. public static bool2 operator == (half2 lhs, half rhs) { return new bool2 (lhs.x == rhs, lhs.y == rhs); }
  122. /// <summary>Returns the result of a componentwise equality operation on a half value and a half2 vector.</summary>
  123. /// <param name="lhs">Left hand side half to use to compute componentwise equality.</param>
  124. /// <param name="rhs">Right hand side half2 to use to compute componentwise equality.</param>
  125. /// <returns>bool2 result of the componentwise equality.</returns>
  126. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  127. public static bool2 operator == (half lhs, half2 rhs) { return new bool2 (lhs == rhs.x, lhs == rhs.y); }
  128. /// <summary>Returns the result of a componentwise not equal operation on two half2 vectors.</summary>
  129. /// <param name="lhs">Left hand side half2 to use to compute componentwise not equal.</param>
  130. /// <param name="rhs">Right hand side half2 to use to compute componentwise not equal.</param>
  131. /// <returns>bool2 result of the componentwise not equal.</returns>
  132. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  133. public static bool2 operator != (half2 lhs, half2 rhs) { return new bool2 (lhs.x != rhs.x, lhs.y != rhs.y); }
  134. /// <summary>Returns the result of a componentwise not equal operation on a half2 vector and a half value.</summary>
  135. /// <param name="lhs">Left hand side half2 to use to compute componentwise not equal.</param>
  136. /// <param name="rhs">Right hand side half to use to compute componentwise not equal.</param>
  137. /// <returns>bool2 result of the componentwise not equal.</returns>
  138. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  139. public static bool2 operator != (half2 lhs, half rhs) { return new bool2 (lhs.x != rhs, lhs.y != rhs); }
  140. /// <summary>Returns the result of a componentwise not equal operation on a half value and a half2 vector.</summary>
  141. /// <param name="lhs">Left hand side half to use to compute componentwise not equal.</param>
  142. /// <param name="rhs">Right hand side half2 to use to compute componentwise not equal.</param>
  143. /// <returns>bool2 result of the componentwise not equal.</returns>
  144. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  145. public static bool2 operator != (half lhs, half2 rhs) { return new bool2 (lhs != rhs.x, lhs != rhs.y); }
  146. /// <summary>Swizzles the vector.</summary>
  147. [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
  148. public half4 xxxx
  149. {
  150. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  151. get { return new half4(x, x, x, x); }
  152. }
  153. /// <summary>Swizzles the vector.</summary>
  154. [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
  155. public half4 xxxy
  156. {
  157. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  158. get { return new half4(x, x, x, y); }
  159. }
  160. /// <summary>Swizzles the vector.</summary>
  161. [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
  162. public half4 xxyx
  163. {
  164. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  165. get { return new half4(x, x, y, x); }
  166. }
  167. /// <summary>Swizzles the vector.</summary>
  168. [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
  169. public half4 xxyy
  170. {
  171. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  172. get { return new half4(x, x, y, y); }
  173. }
  174. /// <summary>Swizzles the vector.</summary>
  175. [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
  176. public half4 xyxx
  177. {
  178. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  179. get { return new half4(x, y, x, x); }
  180. }
  181. /// <summary>Swizzles the vector.</summary>
  182. [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
  183. public half4 xyxy
  184. {
  185. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  186. get { return new half4(x, y, x, y); }
  187. }
  188. /// <summary>Swizzles the vector.</summary>
  189. [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
  190. public half4 xyyx
  191. {
  192. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  193. get { return new half4(x, y, y, x); }
  194. }
  195. /// <summary>Swizzles the vector.</summary>
  196. [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
  197. public half4 xyyy
  198. {
  199. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  200. get { return new half4(x, y, y, y); }
  201. }
  202. /// <summary>Swizzles the vector.</summary>
  203. [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
  204. public half4 yxxx
  205. {
  206. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  207. get { return new half4(y, x, x, x); }
  208. }
  209. /// <summary>Swizzles the vector.</summary>
  210. [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
  211. public half4 yxxy
  212. {
  213. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  214. get { return new half4(y, x, x, y); }
  215. }
  216. /// <summary>Swizzles the vector.</summary>
  217. [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
  218. public half4 yxyx
  219. {
  220. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  221. get { return new half4(y, x, y, x); }
  222. }
  223. /// <summary>Swizzles the vector.</summary>
  224. [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
  225. public half4 yxyy
  226. {
  227. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  228. get { return new half4(y, x, y, y); }
  229. }
  230. /// <summary>Swizzles the vector.</summary>
  231. [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
  232. public half4 yyxx
  233. {
  234. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  235. get { return new half4(y, y, x, x); }
  236. }
  237. /// <summary>Swizzles the vector.</summary>
  238. [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
  239. public half4 yyxy
  240. {
  241. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  242. get { return new half4(y, y, x, y); }
  243. }
  244. /// <summary>Swizzles the vector.</summary>
  245. [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
  246. public half4 yyyx
  247. {
  248. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  249. get { return new half4(y, y, y, x); }
  250. }
  251. /// <summary>Swizzles the vector.</summary>
  252. [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
  253. public half4 yyyy
  254. {
  255. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  256. get { return new half4(y, y, y, y); }
  257. }
  258. /// <summary>Swizzles the vector.</summary>
  259. [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
  260. public half3 xxx
  261. {
  262. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  263. get { return new half3(x, x, x); }
  264. }
  265. /// <summary>Swizzles the vector.</summary>
  266. [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
  267. public half3 xxy
  268. {
  269. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  270. get { return new half3(x, x, y); }
  271. }
  272. /// <summary>Swizzles the vector.</summary>
  273. [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
  274. public half3 xyx
  275. {
  276. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  277. get { return new half3(x, y, x); }
  278. }
  279. /// <summary>Swizzles the vector.</summary>
  280. [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
  281. public half3 xyy
  282. {
  283. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  284. get { return new half3(x, y, y); }
  285. }
  286. /// <summary>Swizzles the vector.</summary>
  287. [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
  288. public half3 yxx
  289. {
  290. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  291. get { return new half3(y, x, x); }
  292. }
  293. /// <summary>Swizzles the vector.</summary>
  294. [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
  295. public half3 yxy
  296. {
  297. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  298. get { return new half3(y, x, y); }
  299. }
  300. /// <summary>Swizzles the vector.</summary>
  301. [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
  302. public half3 yyx
  303. {
  304. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  305. get { return new half3(y, y, x); }
  306. }
  307. /// <summary>Swizzles the vector.</summary>
  308. [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
  309. public half3 yyy
  310. {
  311. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  312. get { return new half3(y, y, y); }
  313. }
  314. /// <summary>Swizzles the vector.</summary>
  315. [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
  316. public half2 xx
  317. {
  318. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  319. get { return new half2(x, x); }
  320. }
  321. /// <summary>Swizzles the vector.</summary>
  322. [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
  323. public half2 xy
  324. {
  325. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  326. get { return new half2(x, y); }
  327. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  328. set { x = value.x; y = value.y; }
  329. }
  330. /// <summary>Swizzles the vector.</summary>
  331. [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
  332. public half2 yx
  333. {
  334. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  335. get { return new half2(y, x); }
  336. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  337. set { y = value.x; x = value.y; }
  338. }
  339. /// <summary>Swizzles the vector.</summary>
  340. [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
  341. public half2 yy
  342. {
  343. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  344. get { return new half2(y, y); }
  345. }
  346. /// <summary>Returns the half element at a specified index.</summary>
  347. unsafe public half this[int index]
  348. {
  349. get
  350. {
  351. #if ENABLE_UNITY_COLLECTIONS_CHECKS
  352. if ((uint)index >= 2)
  353. throw new System.ArgumentException("index must be between[0...1]");
  354. #endif
  355. fixed (half2* array = &this) { return ((half*)array)[index]; }
  356. }
  357. set
  358. {
  359. #if ENABLE_UNITY_COLLECTIONS_CHECKS
  360. if ((uint)index >= 2)
  361. throw new System.ArgumentException("index must be between[0...1]");
  362. #endif
  363. fixed (half* array = &x) { array[index] = value; }
  364. }
  365. }
  366. /// <summary>Returns true if the half2 is equal to a given half2, false otherwise.</summary>
  367. /// <param name="rhs">Right hand side argument to compare equality with.</param>
  368. /// <returns>The result of the equality comparison.</returns>
  369. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  370. public bool Equals(half2 rhs) { return x == rhs.x && y == rhs.y; }
  371. /// <summary>Returns true if the half2 is equal to a given half2, false otherwise.</summary>
  372. /// <param name="o">Right hand side argument to compare equality with.</param>
  373. /// <returns>The result of the equality comparison.</returns>
  374. public override bool Equals(object o) { return o is half2 converted && Equals(converted); }
  375. /// <summary>Returns a hash code for the half2.</summary>
  376. /// <returns>The computed hash code.</returns>
  377. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  378. public override int GetHashCode() { return (int)math.hash(this); }
  379. /// <summary>Returns a string representation of the half2.</summary>
  380. /// <returns>String representation of the value.</returns>
  381. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  382. public override string ToString()
  383. {
  384. return string.Format("half2({0}, {1})", x, y);
  385. }
  386. /// <summary>Returns a string representation of the half2 using a specified format and culture-specific format information.</summary>
  387. /// <param name="format">Format string to use during string formatting.</param>
  388. /// <param name="formatProvider">Format provider to use during string formatting.</param>
  389. /// <returns>String representation of the value.</returns>
  390. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  391. public string ToString(string format, IFormatProvider formatProvider)
  392. {
  393. return string.Format("half2({0}, {1})", x.ToString(format, formatProvider), y.ToString(format, formatProvider));
  394. }
  395. internal sealed class DebuggerProxy
  396. {
  397. public half x;
  398. public half y;
  399. public DebuggerProxy(half2 v)
  400. {
  401. x = v.x;
  402. y = v.y;
  403. }
  404. }
  405. }
  406. public static partial class math
  407. {
  408. /// <summary>Returns a half2 vector constructed from two half values.</summary>
  409. /// <param name="x">The constructed vector's x component will be set to this value.</param>
  410. /// <param name="y">The constructed vector's y component will be set to this value.</param>
  411. /// <returns>half2 constructed from arguments.</returns>
  412. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  413. public static half2 half2(half x, half y) { return new half2(x, y); }
  414. /// <summary>Returns a half2 vector constructed from a half2 vector.</summary>
  415. /// <param name="xy">The constructed vector's xy components will be set to this value.</param>
  416. /// <returns>half2 constructed from arguments.</returns>
  417. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  418. public static half2 half2(half2 xy) { return new half2(xy); }
  419. /// <summary>Returns a half2 vector constructed from a single half value by assigning it to every component.</summary>
  420. /// <param name="v">half to convert to half2</param>
  421. /// <returns>Converted value.</returns>
  422. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  423. public static half2 half2(half v) { return new half2(v); }
  424. /// <summary>Returns a half2 vector constructed from a single float value by converting it to half and assigning it to every component.</summary>
  425. /// <param name="v">float to convert to half2</param>
  426. /// <returns>Converted value.</returns>
  427. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  428. public static half2 half2(float v) { return new half2(v); }
  429. /// <summary>Return a half2 vector constructed from a float2 vector by componentwise conversion.</summary>
  430. /// <param name="v">float2 to convert to half2</param>
  431. /// <returns>Converted value.</returns>
  432. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  433. public static half2 half2(float2 v) { return new half2(v); }
  434. /// <summary>Returns a half2 vector constructed from a single double value by converting it to half and assigning it to every component.</summary>
  435. /// <param name="v">double to convert to half2</param>
  436. /// <returns>Converted value.</returns>
  437. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  438. public static half2 half2(double v) { return new half2(v); }
  439. /// <summary>Return a half2 vector constructed from a double2 vector by componentwise conversion.</summary>
  440. /// <param name="v">double2 to convert to half2</param>
  441. /// <returns>Converted value.</returns>
  442. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  443. public static half2 half2(double2 v) { return new half2(v); }
  444. /// <summary>Returns a uint hash code of a half2 vector.</summary>
  445. /// <param name="v">Vector value to hash.</param>
  446. /// <returns>uint hash of the argument.</returns>
  447. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  448. public static uint hash(half2 v)
  449. {
  450. return csum(uint2(v.x.value, v.y.value) * uint2(0x6E624EB7u, 0x7383ED49u)) + 0xDD49C23Bu;
  451. }
  452. /// <summary>
  453. /// Returns a uint2 vector hash code of a half2 vector.
  454. /// When multiple elements are to be hashes together, it can more efficient to calculate and combine wide hash
  455. /// that are only reduced to a narrow uint hash at the very end instead of at every step.
  456. /// </summary>
  457. /// <param name="v">Vector value to hash.</param>
  458. /// <returns>uint2 hash of the argument.</returns>
  459. [MethodImpl(MethodImplOptions.AggressiveInlining)]
  460. public static uint2 hashwide(half2 v)
  461. {
  462. return (uint2(v.x.value, v.y.value) * uint2(0xEBD0D005u, 0x91475DF7u)) + 0x55E84827u;
  463. }
  464. }
  465. }