A game about forced loneliness, made by TACStudios
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//------------------------------------------------------------------------------ 9using System; 10using System.Runtime.CompilerServices; 11using System.Runtime.InteropServices; 12using System.Diagnostics; 13using Unity.IL2CPP.CompilerServices; 14 15#pragma warning disable 0660, 0661 16 17namespace Unity.Mathematics 18{ 19 /// <summary>A 2 component vector of bools.</summary> 20 [DebuggerTypeProxy(typeof(bool2.DebuggerProxy))] 21 [System.Serializable] 22 [Il2CppEagerStaticClassConstruction] 23 public partial struct bool2 : System.IEquatable<bool2> 24 { 25 /// <summary>x component of the vector.</summary> 26 [MarshalAs(UnmanagedType.U1)] 27 public bool x; 28 /// <summary>y component of the vector.</summary> 29 [MarshalAs(UnmanagedType.U1)] 30 public bool y; 31 32 33 /// <summary>Constructs a bool2 vector from two bool values.</summary> 34 /// <param name="x">The constructed vector's x component will be set to this value.</param> 35 /// <param name="y">The constructed vector's y component will be set to this value.</param> 36 [MethodImpl(MethodImplOptions.AggressiveInlining)] 37 public bool2(bool x, bool y) 38 { 39 this.x = x; 40 this.y = y; 41 } 42 43 /// <summary>Constructs a bool2 vector from a bool2 vector.</summary> 44 /// <param name="xy">The constructed vector's xy components will be set to this value.</param> 45 [MethodImpl(MethodImplOptions.AggressiveInlining)] 46 public bool2(bool2 xy) 47 { 48 this.x = xy.x; 49 this.y = xy.y; 50 } 51 52 /// <summary>Constructs a bool2 vector from a single bool value by assigning it to every component.</summary> 53 /// <param name="v">bool to convert to bool2</param> 54 [MethodImpl(MethodImplOptions.AggressiveInlining)] 55 public bool2(bool v) 56 { 57 this.x = v; 58 this.y = v; 59 } 60 61 62 /// <summary>Implicitly converts a single bool value to a bool2 vector by assigning it to every component.</summary> 63 /// <param name="v">bool to convert to bool2</param> 64 /// <returns>Converted value.</returns> 65 [MethodImpl(MethodImplOptions.AggressiveInlining)] 66 public static implicit operator bool2(bool v) { return new bool2(v); } 67 68 69 /// <summary>Returns the result of a componentwise equality operation on two bool2 vectors.</summary> 70 /// <param name="lhs">Left hand side bool2 to use to compute componentwise equality.</param> 71 /// <param name="rhs">Right hand side bool2 to use to compute componentwise equality.</param> 72 /// <returns>bool2 result of the componentwise equality.</returns> 73 [MethodImpl(MethodImplOptions.AggressiveInlining)] 74 public static bool2 operator == (bool2 lhs, bool2 rhs) { return new bool2 (lhs.x == rhs.x, lhs.y == rhs.y); } 75 76 /// <summary>Returns the result of a componentwise equality operation on a bool2 vector and a bool value.</summary> 77 /// <param name="lhs">Left hand side bool2 to use to compute componentwise equality.</param> 78 /// <param name="rhs">Right hand side bool to use to compute componentwise equality.</param> 79 /// <returns>bool2 result of the componentwise equality.</returns> 80 [MethodImpl(MethodImplOptions.AggressiveInlining)] 81 public static bool2 operator == (bool2 lhs, bool rhs) { return new bool2 (lhs.x == rhs, lhs.y == rhs); } 82 83 /// <summary>Returns the result of a componentwise equality operation on a bool value and a bool2 vector.</summary> 84 /// <param name="lhs">Left hand side bool to use to compute componentwise equality.</param> 85 /// <param name="rhs">Right hand side bool2 to use to compute componentwise equality.</param> 86 /// <returns>bool2 result of the componentwise equality.</returns> 87 [MethodImpl(MethodImplOptions.AggressiveInlining)] 88 public static bool2 operator == (bool lhs, bool2 rhs) { return new bool2 (lhs == rhs.x, lhs == rhs.y); } 89 90 91 /// <summary>Returns the result of a componentwise not equal operation on two bool2 vectors.</summary> 92 /// <param name="lhs">Left hand side bool2 to use to compute componentwise not equal.</param> 93 /// <param name="rhs">Right hand side bool2 to use to compute componentwise not equal.</param> 94 /// <returns>bool2 result of the componentwise not equal.</returns> 95 [MethodImpl(MethodImplOptions.AggressiveInlining)] 96 public static bool2 operator != (bool2 lhs, bool2 rhs) { return new bool2 (lhs.x != rhs.x, lhs.y != rhs.y); } 97 98 /// <summary>Returns the result of a componentwise not equal operation on a bool2 vector and a bool value.</summary> 99 /// <param name="lhs">Left hand side bool2 to use to compute componentwise not equal.</param> 100 /// <param name="rhs">Right hand side bool to use to compute componentwise not equal.</param> 101 /// <returns>bool2 result of the componentwise not equal.</returns> 102 [MethodImpl(MethodImplOptions.AggressiveInlining)] 103 public static bool2 operator != (bool2 lhs, bool rhs) { return new bool2 (lhs.x != rhs, lhs.y != rhs); } 104 105 /// <summary>Returns the result of a componentwise not equal operation on a bool value and a bool2 vector.</summary> 106 /// <param name="lhs">Left hand side bool to use to compute componentwise not equal.</param> 107 /// <param name="rhs">Right hand side bool2 to use to compute componentwise not equal.</param> 108 /// <returns>bool2 result of the componentwise not equal.</returns> 109 [MethodImpl(MethodImplOptions.AggressiveInlining)] 110 public static bool2 operator != (bool lhs, bool2 rhs) { return new bool2 (lhs != rhs.x, lhs != rhs.y); } 111 112 113 /// <summary>Returns the result of a componentwise not operation on a bool2 vector.</summary> 114 /// <param name="val">Value to use when computing the componentwise not.</param> 115 /// <returns>bool2 result of the componentwise not.</returns> 116 [MethodImpl(MethodImplOptions.AggressiveInlining)] 117 public static bool2 operator ! (bool2 val) { return new bool2 (!val.x, !val.y); } 118 119 120 /// <summary>Returns the result of a componentwise bitwise and operation on two bool2 vectors.</summary> 121 /// <param name="lhs">Left hand side bool2 to use to compute componentwise bitwise and.</param> 122 /// <param name="rhs">Right hand side bool2 to use to compute componentwise bitwise and.</param> 123 /// <returns>bool2 result of the componentwise bitwise and.</returns> 124 [MethodImpl(MethodImplOptions.AggressiveInlining)] 125 public static bool2 operator & (bool2 lhs, bool2 rhs) { return new bool2 (lhs.x & rhs.x, lhs.y & rhs.y); } 126 127 /// <summary>Returns the result of a componentwise bitwise and operation on a bool2 vector and a bool value.</summary> 128 /// <param name="lhs">Left hand side bool2 to use to compute componentwise bitwise and.</param> 129 /// <param name="rhs">Right hand side bool to use to compute componentwise bitwise and.</param> 130 /// <returns>bool2 result of the componentwise bitwise and.</returns> 131 [MethodImpl(MethodImplOptions.AggressiveInlining)] 132 public static bool2 operator & (bool2 lhs, bool rhs) { return new bool2 (lhs.x & rhs, lhs.y & rhs); } 133 134 /// <summary>Returns the result of a componentwise bitwise and operation on a bool value and a bool2 vector.</summary> 135 /// <param name="lhs">Left hand side bool to use to compute componentwise bitwise and.</param> 136 /// <param name="rhs">Right hand side bool2 to use to compute componentwise bitwise and.</param> 137 /// <returns>bool2 result of the componentwise bitwise and.</returns> 138 [MethodImpl(MethodImplOptions.AggressiveInlining)] 139 public static bool2 operator & (bool lhs, bool2 rhs) { return new bool2 (lhs & rhs.x, lhs & rhs.y); } 140 141 142 /// <summary>Returns the result of a componentwise bitwise or operation on two bool2 vectors.</summary> 143 /// <param name="lhs">Left hand side bool2 to use to compute componentwise bitwise or.</param> 144 /// <param name="rhs">Right hand side bool2 to use to compute componentwise bitwise or.</param> 145 /// <returns>bool2 result of the componentwise bitwise or.</returns> 146 [MethodImpl(MethodImplOptions.AggressiveInlining)] 147 public static bool2 operator | (bool2 lhs, bool2 rhs) { return new bool2 (lhs.x | rhs.x, lhs.y | rhs.y); } 148 149 /// <summary>Returns the result of a componentwise bitwise or operation on a bool2 vector and a bool value.</summary> 150 /// <param name="lhs">Left hand side bool2 to use to compute componentwise bitwise or.</param> 151 /// <param name="rhs">Right hand side bool to use to compute componentwise bitwise or.</param> 152 /// <returns>bool2 result of the componentwise bitwise or.</returns> 153 [MethodImpl(MethodImplOptions.AggressiveInlining)] 154 public static bool2 operator | (bool2 lhs, bool rhs) { return new bool2 (lhs.x | rhs, lhs.y | rhs); } 155 156 /// <summary>Returns the result of a componentwise bitwise or operation on a bool value and a bool2 vector.</summary> 157 /// <param name="lhs">Left hand side bool to use to compute componentwise bitwise or.</param> 158 /// <param name="rhs">Right hand side bool2 to use to compute componentwise bitwise or.</param> 159 /// <returns>bool2 result of the componentwise bitwise or.</returns> 160 [MethodImpl(MethodImplOptions.AggressiveInlining)] 161 public static bool2 operator | (bool lhs, bool2 rhs) { return new bool2 (lhs | rhs.x, lhs | rhs.y); } 162 163 164 /// <summary>Returns the result of a componentwise bitwise exclusive or operation on two bool2 vectors.</summary> 165 /// <param name="lhs">Left hand side bool2 to use to compute componentwise bitwise exclusive or.</param> 166 /// <param name="rhs">Right hand side bool2 to use to compute componentwise bitwise exclusive or.</param> 167 /// <returns>bool2 result of the componentwise bitwise exclusive or.</returns> 168 [MethodImpl(MethodImplOptions.AggressiveInlining)] 169 public static bool2 operator ^ (bool2 lhs, bool2 rhs) { return new bool2 (lhs.x ^ rhs.x, lhs.y ^ rhs.y); } 170 171 /// <summary>Returns the result of a componentwise bitwise exclusive or operation on a bool2 vector and a bool value.</summary> 172 /// <param name="lhs">Left hand side bool2 to use to compute componentwise bitwise exclusive or.</param> 173 /// <param name="rhs">Right hand side bool to use to compute componentwise bitwise exclusive or.</param> 174 /// <returns>bool2 result of the componentwise bitwise exclusive or.</returns> 175 [MethodImpl(MethodImplOptions.AggressiveInlining)] 176 public static bool2 operator ^ (bool2 lhs, bool rhs) { return new bool2 (lhs.x ^ rhs, lhs.y ^ rhs); } 177 178 /// <summary>Returns the result of a componentwise bitwise exclusive or operation on a bool value and a bool2 vector.</summary> 179 /// <param name="lhs">Left hand side bool to use to compute componentwise bitwise exclusive or.</param> 180 /// <param name="rhs">Right hand side bool2 to use to compute componentwise bitwise exclusive or.</param> 181 /// <returns>bool2 result of the componentwise bitwise exclusive or.</returns> 182 [MethodImpl(MethodImplOptions.AggressiveInlining)] 183 public static bool2 operator ^ (bool lhs, bool2 rhs) { return new bool2 (lhs ^ rhs.x, lhs ^ rhs.y); } 184 185 186 187 188 /// <summary>Swizzles the vector.</summary> 189 [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] 190 public bool4 xxxx 191 { 192 [MethodImpl(MethodImplOptions.AggressiveInlining)] 193 get { return new bool4(x, x, x, x); } 194 } 195 196 197 /// <summary>Swizzles the vector.</summary> 198 [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] 199 public bool4 xxxy 200 { 201 [MethodImpl(MethodImplOptions.AggressiveInlining)] 202 get { return new bool4(x, x, x, y); } 203 } 204 205 206 /// <summary>Swizzles the vector.</summary> 207 [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] 208 public bool4 xxyx 209 { 210 [MethodImpl(MethodImplOptions.AggressiveInlining)] 211 get { return new bool4(x, x, y, x); } 212 } 213 214 215 /// <summary>Swizzles the vector.</summary> 216 [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] 217 public bool4 xxyy 218 { 219 [MethodImpl(MethodImplOptions.AggressiveInlining)] 220 get { return new bool4(x, x, y, y); } 221 } 222 223 224 /// <summary>Swizzles the vector.</summary> 225 [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] 226 public bool4 xyxx 227 { 228 [MethodImpl(MethodImplOptions.AggressiveInlining)] 229 get { return new bool4(x, y, x, x); } 230 } 231 232 233 /// <summary>Swizzles the vector.</summary> 234 [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] 235 public bool4 xyxy 236 { 237 [MethodImpl(MethodImplOptions.AggressiveInlining)] 238 get { return new bool4(x, y, x, y); } 239 } 240 241 242 /// <summary>Swizzles the vector.</summary> 243 [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] 244 public bool4 xyyx 245 { 246 [MethodImpl(MethodImplOptions.AggressiveInlining)] 247 get { return new bool4(x, y, y, x); } 248 } 249 250 251 /// <summary>Swizzles the vector.</summary> 252 [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] 253 public bool4 xyyy 254 { 255 [MethodImpl(MethodImplOptions.AggressiveInlining)] 256 get { return new bool4(x, y, y, y); } 257 } 258 259 260 /// <summary>Swizzles the vector.</summary> 261 [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] 262 public bool4 yxxx 263 { 264 [MethodImpl(MethodImplOptions.AggressiveInlining)] 265 get { return new bool4(y, x, x, x); } 266 } 267 268 269 /// <summary>Swizzles the vector.</summary> 270 [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] 271 public bool4 yxxy 272 { 273 [MethodImpl(MethodImplOptions.AggressiveInlining)] 274 get { return new bool4(y, x, x, y); } 275 } 276 277 278 /// <summary>Swizzles the vector.</summary> 279 [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] 280 public bool4 yxyx 281 { 282 [MethodImpl(MethodImplOptions.AggressiveInlining)] 283 get { return new bool4(y, x, y, x); } 284 } 285 286 287 /// <summary>Swizzles the vector.</summary> 288 [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] 289 public bool4 yxyy 290 { 291 [MethodImpl(MethodImplOptions.AggressiveInlining)] 292 get { return new bool4(y, x, y, y); } 293 } 294 295 296 /// <summary>Swizzles the vector.</summary> 297 [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] 298 public bool4 yyxx 299 { 300 [MethodImpl(MethodImplOptions.AggressiveInlining)] 301 get { return new bool4(y, y, x, x); } 302 } 303 304 305 /// <summary>Swizzles the vector.</summary> 306 [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] 307 public bool4 yyxy 308 { 309 [MethodImpl(MethodImplOptions.AggressiveInlining)] 310 get { return new bool4(y, y, x, y); } 311 } 312 313 314 /// <summary>Swizzles the vector.</summary> 315 [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] 316 public bool4 yyyx 317 { 318 [MethodImpl(MethodImplOptions.AggressiveInlining)] 319 get { return new bool4(y, y, y, x); } 320 } 321 322 323 /// <summary>Swizzles the vector.</summary> 324 [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] 325 public bool4 yyyy 326 { 327 [MethodImpl(MethodImplOptions.AggressiveInlining)] 328 get { return new bool4(y, y, y, y); } 329 } 330 331 332 /// <summary>Swizzles the vector.</summary> 333 [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] 334 public bool3 xxx 335 { 336 [MethodImpl(MethodImplOptions.AggressiveInlining)] 337 get { return new bool3(x, x, x); } 338 } 339 340 341 /// <summary>Swizzles the vector.</summary> 342 [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] 343 public bool3 xxy 344 { 345 [MethodImpl(MethodImplOptions.AggressiveInlining)] 346 get { return new bool3(x, x, y); } 347 } 348 349 350 /// <summary>Swizzles the vector.</summary> 351 [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] 352 public bool3 xyx 353 { 354 [MethodImpl(MethodImplOptions.AggressiveInlining)] 355 get { return new bool3(x, y, x); } 356 } 357 358 359 /// <summary>Swizzles the vector.</summary> 360 [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] 361 public bool3 xyy 362 { 363 [MethodImpl(MethodImplOptions.AggressiveInlining)] 364 get { return new bool3(x, y, y); } 365 } 366 367 368 /// <summary>Swizzles the vector.</summary> 369 [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] 370 public bool3 yxx 371 { 372 [MethodImpl(MethodImplOptions.AggressiveInlining)] 373 get { return new bool3(y, x, x); } 374 } 375 376 377 /// <summary>Swizzles the vector.</summary> 378 [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] 379 public bool3 yxy 380 { 381 [MethodImpl(MethodImplOptions.AggressiveInlining)] 382 get { return new bool3(y, x, y); } 383 } 384 385 386 /// <summary>Swizzles the vector.</summary> 387 [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] 388 public bool3 yyx 389 { 390 [MethodImpl(MethodImplOptions.AggressiveInlining)] 391 get { return new bool3(y, y, x); } 392 } 393 394 395 /// <summary>Swizzles the vector.</summary> 396 [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] 397 public bool3 yyy 398 { 399 [MethodImpl(MethodImplOptions.AggressiveInlining)] 400 get { return new bool3(y, y, y); } 401 } 402 403 404 /// <summary>Swizzles the vector.</summary> 405 [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] 406 public bool2 xx 407 { 408 [MethodImpl(MethodImplOptions.AggressiveInlining)] 409 get { return new bool2(x, x); } 410 } 411 412 413 /// <summary>Swizzles the vector.</summary> 414 [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] 415 public bool2 xy 416 { 417 [MethodImpl(MethodImplOptions.AggressiveInlining)] 418 get { return new bool2(x, y); } 419 [MethodImpl(MethodImplOptions.AggressiveInlining)] 420 set { x = value.x; y = value.y; } 421 } 422 423 424 /// <summary>Swizzles the vector.</summary> 425 [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] 426 public bool2 yx 427 { 428 [MethodImpl(MethodImplOptions.AggressiveInlining)] 429 get { return new bool2(y, x); } 430 [MethodImpl(MethodImplOptions.AggressiveInlining)] 431 set { y = value.x; x = value.y; } 432 } 433 434 435 /// <summary>Swizzles the vector.</summary> 436 [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] 437 public bool2 yy 438 { 439 [MethodImpl(MethodImplOptions.AggressiveInlining)] 440 get { return new bool2(y, y); } 441 } 442 443 444 445 /// <summary>Returns the bool element at a specified index.</summary> 446 unsafe public bool this[int index] 447 { 448 get 449 { 450#if ENABLE_UNITY_COLLECTIONS_CHECKS 451 if ((uint)index >= 2) 452 throw new System.ArgumentException("index must be between[0...1]"); 453#endif 454 fixed (bool2* array = &this) { return ((bool*)array)[index]; } 455 } 456 set 457 { 458#if ENABLE_UNITY_COLLECTIONS_CHECKS 459 if ((uint)index >= 2) 460 throw new System.ArgumentException("index must be between[0...1]"); 461#endif 462 fixed (bool* array = &x) { array[index] = value; } 463 } 464 } 465 466 /// <summary>Returns true if the bool2 is equal to a given bool2, false otherwise.</summary> 467 /// <param name="rhs">Right hand side argument to compare equality with.</param> 468 /// <returns>The result of the equality comparison.</returns> 469 [MethodImpl(MethodImplOptions.AggressiveInlining)] 470 public bool Equals(bool2 rhs) { return x == rhs.x && y == rhs.y; } 471 472 /// <summary>Returns true if the bool2 is equal to a given bool2, false otherwise.</summary> 473 /// <param name="o">Right hand side argument to compare equality with.</param> 474 /// <returns>The result of the equality comparison.</returns> 475 public override bool Equals(object o) { return o is bool2 converted && Equals(converted); } 476 477 478 /// <summary>Returns a hash code for the bool2.</summary> 479 /// <returns>The computed hash code.</returns> 480 [MethodImpl(MethodImplOptions.AggressiveInlining)] 481 public override int GetHashCode() { return (int)math.hash(this); } 482 483 484 /// <summary>Returns a string representation of the bool2.</summary> 485 /// <returns>String representation of the value.</returns> 486 [MethodImpl(MethodImplOptions.AggressiveInlining)] 487 public override string ToString() 488 { 489 return string.Format("bool2({0}, {1})", x, y); 490 } 491 492 internal sealed class DebuggerProxy 493 { 494 public bool x; 495 public bool y; 496 public DebuggerProxy(bool2 v) 497 { 498 x = v.x; 499 y = v.y; 500 } 501 } 502 503 } 504 505 public static partial class math 506 { 507 /// <summary>Returns a bool2 vector constructed from two bool values.</summary> 508 /// <param name="x">The constructed vector's x component will be set to this value.</param> 509 /// <param name="y">The constructed vector's y component will be set to this value.</param> 510 /// <returns>bool2 constructed from arguments.</returns> 511 [MethodImpl(MethodImplOptions.AggressiveInlining)] 512 public static bool2 bool2(bool x, bool y) { return new bool2(x, y); } 513 514 /// <summary>Returns a bool2 vector constructed from a bool2 vector.</summary> 515 /// <param name="xy">The constructed vector's xy components will be set to this value.</param> 516 /// <returns>bool2 constructed from arguments.</returns> 517 [MethodImpl(MethodImplOptions.AggressiveInlining)] 518 public static bool2 bool2(bool2 xy) { return new bool2(xy); } 519 520 /// <summary>Returns a bool2 vector constructed from a single bool value by assigning it to every component.</summary> 521 /// <param name="v">bool to convert to bool2</param> 522 /// <returns>Converted value.</returns> 523 [MethodImpl(MethodImplOptions.AggressiveInlining)] 524 public static bool2 bool2(bool v) { return new bool2(v); } 525 526 /// <summary>Returns a uint hash code of a bool2 vector.</summary> 527 /// <param name="v">Vector value to hash.</param> 528 /// <returns>uint hash of the argument.</returns> 529 [MethodImpl(MethodImplOptions.AggressiveInlining)] 530 public static uint hash(bool2 v) 531 { 532 return csum(select(uint2(0x90A285BBu, 0x5D19E1D5u), uint2(0xFAAF07DDu, 0x625C45BDu), v)); 533 } 534 535 /// <summary> 536 /// Returns a uint2 vector hash code of a bool2 vector. 537 /// When multiple elements are to be hashes together, it can more efficient to calculate and combine wide hash 538 /// that are only reduced to a narrow uint hash at the very end instead of at every step. 539 /// </summary> 540 /// <param name="v">Vector value to hash.</param> 541 /// <returns>uint2 hash of the argument.</returns> 542 [MethodImpl(MethodImplOptions.AggressiveInlining)] 543 public static uint2 hashwide(bool2 v) 544 { 545 return (select(uint2(0xC9F27FCBu, 0x6D2523B1u), uint2(0x6E2BF6A9u, 0xCC74B3B7u), v)); 546 } 547 548 /// <summary>Returns the result of specified shuffling of the components from two bool2 vectors into a bool value.</summary> 549 /// <param name="left">bool2 to use as the left argument of the shuffle operation.</param> 550 /// <param name="right">bool2 to use as the right argument of the shuffle operation.</param> 551 /// <param name="x">The ShuffleComponent to use when setting the resulting bool.</param> 552 /// <returns>bool result of the shuffle operation.</returns> 553 [MethodImpl(MethodImplOptions.AggressiveInlining)] 554 public static bool shuffle(bool2 left, bool2 right, ShuffleComponent x) 555 { 556 return select_shuffle_component(left, right, x); 557 } 558 559 /// <summary>Returns the result of specified shuffling of the components from two bool2 vectors into a bool2 vector.</summary> 560 /// <param name="left">bool2 to use as the left argument of the shuffle operation.</param> 561 /// <param name="right">bool2 to use as the right argument of the shuffle operation.</param> 562 /// <param name="x">The ShuffleComponent to use when setting the resulting bool2 x component.</param> 563 /// <param name="y">The ShuffleComponent to use when setting the resulting bool2 y component.</param> 564 /// <returns>bool2 result of the shuffle operation.</returns> 565 [MethodImpl(MethodImplOptions.AggressiveInlining)] 566 public static bool2 shuffle(bool2 left, bool2 right, ShuffleComponent x, ShuffleComponent y) 567 { 568 return bool2( 569 select_shuffle_component(left, right, x), 570 select_shuffle_component(left, right, y)); 571 } 572 573 /// <summary>Returns the result of specified shuffling of the components from two bool2 vectors into a bool3 vector.</summary> 574 /// <param name="left">bool2 to use as the left argument of the shuffle operation.</param> 575 /// <param name="right">bool2 to use as the right argument of the shuffle operation.</param> 576 /// <param name="x">The ShuffleComponent to use when setting the resulting bool3 x component.</param> 577 /// <param name="y">The ShuffleComponent to use when setting the resulting bool3 y component.</param> 578 /// <param name="z">The ShuffleComponent to use when setting the resulting bool3 z component.</param> 579 /// <returns>bool3 result of the shuffle operation.</returns> 580 [MethodImpl(MethodImplOptions.AggressiveInlining)] 581 public static bool3 shuffle(bool2 left, bool2 right, ShuffleComponent x, ShuffleComponent y, ShuffleComponent z) 582 { 583 return bool3( 584 select_shuffle_component(left, right, x), 585 select_shuffle_component(left, right, y), 586 select_shuffle_component(left, right, z)); 587 } 588 589 /// <summary>Returns the result of specified shuffling of the components from two bool2 vectors into a bool4 vector.</summary> 590 /// <param name="left">bool2 to use as the left argument of the shuffle operation.</param> 591 /// <param name="right">bool2 to use as the right argument of the shuffle operation.</param> 592 /// <param name="x">The ShuffleComponent to use when setting the resulting bool4 x component.</param> 593 /// <param name="y">The ShuffleComponent to use when setting the resulting bool4 y component.</param> 594 /// <param name="z">The ShuffleComponent to use when setting the resulting bool4 z component.</param> 595 /// <param name="w">The ShuffleComponent to use when setting the resulting bool4 w component.</param> 596 /// <returns>bool4 result of the shuffle operation.</returns> 597 [MethodImpl(MethodImplOptions.AggressiveInlining)] 598 public static bool4 shuffle(bool2 left, bool2 right, ShuffleComponent x, ShuffleComponent y, ShuffleComponent z, ShuffleComponent w) 599 { 600 return bool4( 601 select_shuffle_component(left, right, x), 602 select_shuffle_component(left, right, y), 603 select_shuffle_component(left, right, z), 604 select_shuffle_component(left, right, w)); 605 } 606 607 [MethodImpl(MethodImplOptions.AggressiveInlining)] 608 internal static bool select_shuffle_component(bool2 a, bool2 b, ShuffleComponent component) 609 { 610 switch(component) 611 { 612 case ShuffleComponent.LeftX: 613 return a.x; 614 case ShuffleComponent.LeftY: 615 return a.y; 616 case ShuffleComponent.RightX: 617 return b.x; 618 case ShuffleComponent.RightY: 619 return b.y; 620 default: 621 throw new System.ArgumentException("Invalid shuffle component: " + component); 622 } 623 } 624 625 } 626}