github.com/wzzhu/tensor@v0.9.24/internal/execution/eng_arith.go (about) 1 // Code generated by genlib2. DO NOT EDIT. 2 3 package execution 4 5 import ( 6 "reflect" 7 8 "github.com/pkg/errors" 9 "github.com/wzzhu/tensor/internal/storage" 10 ) 11 12 func (e E) Add(t reflect.Type, a *storage.Header, b *storage.Header) (err error) { 13 as := isScalar(a, t) 14 bs := isScalar(b, t) 15 16 switch t { 17 case Int: 18 at := a.Ints() 19 bt := b.Ints() 20 switch { 21 case as && bs: 22 VecAddI(at, bt) 23 case as && !bs: 24 AddSVI(at[0], bt) 25 case !as && bs: 26 AddVSI(at, bt[0]) 27 default: 28 VecAddI(at, bt) 29 } 30 return 31 case Int8: 32 at := a.Int8s() 33 bt := b.Int8s() 34 switch { 35 case as && bs: 36 VecAddI8(at, bt) 37 case as && !bs: 38 AddSVI8(at[0], bt) 39 case !as && bs: 40 AddVSI8(at, bt[0]) 41 default: 42 VecAddI8(at, bt) 43 } 44 return 45 case Int16: 46 at := a.Int16s() 47 bt := b.Int16s() 48 switch { 49 case as && bs: 50 VecAddI16(at, bt) 51 case as && !bs: 52 AddSVI16(at[0], bt) 53 case !as && bs: 54 AddVSI16(at, bt[0]) 55 default: 56 VecAddI16(at, bt) 57 } 58 return 59 case Int32: 60 at := a.Int32s() 61 bt := b.Int32s() 62 switch { 63 case as && bs: 64 VecAddI32(at, bt) 65 case as && !bs: 66 AddSVI32(at[0], bt) 67 case !as && bs: 68 AddVSI32(at, bt[0]) 69 default: 70 VecAddI32(at, bt) 71 } 72 return 73 case Int64: 74 at := a.Int64s() 75 bt := b.Int64s() 76 switch { 77 case as && bs: 78 VecAddI64(at, bt) 79 case as && !bs: 80 AddSVI64(at[0], bt) 81 case !as && bs: 82 AddVSI64(at, bt[0]) 83 default: 84 VecAddI64(at, bt) 85 } 86 return 87 case Uint: 88 at := a.Uints() 89 bt := b.Uints() 90 switch { 91 case as && bs: 92 VecAddU(at, bt) 93 case as && !bs: 94 AddSVU(at[0], bt) 95 case !as && bs: 96 AddVSU(at, bt[0]) 97 default: 98 VecAddU(at, bt) 99 } 100 return 101 case Uint8: 102 at := a.Uint8s() 103 bt := b.Uint8s() 104 switch { 105 case as && bs: 106 VecAddU8(at, bt) 107 case as && !bs: 108 AddSVU8(at[0], bt) 109 case !as && bs: 110 AddVSU8(at, bt[0]) 111 default: 112 VecAddU8(at, bt) 113 } 114 return 115 case Uint16: 116 at := a.Uint16s() 117 bt := b.Uint16s() 118 switch { 119 case as && bs: 120 VecAddU16(at, bt) 121 case as && !bs: 122 AddSVU16(at[0], bt) 123 case !as && bs: 124 AddVSU16(at, bt[0]) 125 default: 126 VecAddU16(at, bt) 127 } 128 return 129 case Uint32: 130 at := a.Uint32s() 131 bt := b.Uint32s() 132 switch { 133 case as && bs: 134 VecAddU32(at, bt) 135 case as && !bs: 136 AddSVU32(at[0], bt) 137 case !as && bs: 138 AddVSU32(at, bt[0]) 139 default: 140 VecAddU32(at, bt) 141 } 142 return 143 case Uint64: 144 at := a.Uint64s() 145 bt := b.Uint64s() 146 switch { 147 case as && bs: 148 VecAddU64(at, bt) 149 case as && !bs: 150 AddSVU64(at[0], bt) 151 case !as && bs: 152 AddVSU64(at, bt[0]) 153 default: 154 VecAddU64(at, bt) 155 } 156 return 157 case Float32: 158 at := a.Float32s() 159 bt := b.Float32s() 160 switch { 161 case as && bs: 162 VecAddF32(at, bt) 163 case as && !bs: 164 AddSVF32(at[0], bt) 165 case !as && bs: 166 AddVSF32(at, bt[0]) 167 default: 168 VecAddF32(at, bt) 169 } 170 return 171 case Float64: 172 at := a.Float64s() 173 bt := b.Float64s() 174 switch { 175 case as && bs: 176 VecAddF64(at, bt) 177 case as && !bs: 178 AddSVF64(at[0], bt) 179 case !as && bs: 180 AddVSF64(at, bt[0]) 181 default: 182 VecAddF64(at, bt) 183 } 184 return 185 case Complex64: 186 at := a.Complex64s() 187 bt := b.Complex64s() 188 switch { 189 case as && bs: 190 VecAddC64(at, bt) 191 case as && !bs: 192 AddSVC64(at[0], bt) 193 case !as && bs: 194 AddVSC64(at, bt[0]) 195 default: 196 VecAddC64(at, bt) 197 } 198 return 199 case Complex128: 200 at := a.Complex128s() 201 bt := b.Complex128s() 202 switch { 203 case as && bs: 204 VecAddC128(at, bt) 205 case as && !bs: 206 AddSVC128(at[0], bt) 207 case !as && bs: 208 AddVSC128(at, bt[0]) 209 default: 210 VecAddC128(at, bt) 211 } 212 return 213 case String: 214 at := a.Strings() 215 bt := b.Strings() 216 switch { 217 case as && bs: 218 VecAddStr(at, bt) 219 case as && !bs: 220 AddSVStr(at[0], bt) 221 case !as && bs: 222 AddVSStr(at, bt[0]) 223 default: 224 VecAddStr(at, bt) 225 } 226 return 227 default: 228 return errors.Errorf("Unsupported type %v for Add", t) 229 } 230 } 231 232 func (e E) Sub(t reflect.Type, a *storage.Header, b *storage.Header) (err error) { 233 as := isScalar(a, t) 234 bs := isScalar(b, t) 235 236 switch t { 237 case Int: 238 at := a.Ints() 239 bt := b.Ints() 240 switch { 241 case as && bs: 242 VecSubI(at, bt) 243 case as && !bs: 244 SubSVI(at[0], bt) 245 case !as && bs: 246 SubVSI(at, bt[0]) 247 default: 248 VecSubI(at, bt) 249 } 250 return 251 case Int8: 252 at := a.Int8s() 253 bt := b.Int8s() 254 switch { 255 case as && bs: 256 VecSubI8(at, bt) 257 case as && !bs: 258 SubSVI8(at[0], bt) 259 case !as && bs: 260 SubVSI8(at, bt[0]) 261 default: 262 VecSubI8(at, bt) 263 } 264 return 265 case Int16: 266 at := a.Int16s() 267 bt := b.Int16s() 268 switch { 269 case as && bs: 270 VecSubI16(at, bt) 271 case as && !bs: 272 SubSVI16(at[0], bt) 273 case !as && bs: 274 SubVSI16(at, bt[0]) 275 default: 276 VecSubI16(at, bt) 277 } 278 return 279 case Int32: 280 at := a.Int32s() 281 bt := b.Int32s() 282 switch { 283 case as && bs: 284 VecSubI32(at, bt) 285 case as && !bs: 286 SubSVI32(at[0], bt) 287 case !as && bs: 288 SubVSI32(at, bt[0]) 289 default: 290 VecSubI32(at, bt) 291 } 292 return 293 case Int64: 294 at := a.Int64s() 295 bt := b.Int64s() 296 switch { 297 case as && bs: 298 VecSubI64(at, bt) 299 case as && !bs: 300 SubSVI64(at[0], bt) 301 case !as && bs: 302 SubVSI64(at, bt[0]) 303 default: 304 VecSubI64(at, bt) 305 } 306 return 307 case Uint: 308 at := a.Uints() 309 bt := b.Uints() 310 switch { 311 case as && bs: 312 VecSubU(at, bt) 313 case as && !bs: 314 SubSVU(at[0], bt) 315 case !as && bs: 316 SubVSU(at, bt[0]) 317 default: 318 VecSubU(at, bt) 319 } 320 return 321 case Uint8: 322 at := a.Uint8s() 323 bt := b.Uint8s() 324 switch { 325 case as && bs: 326 VecSubU8(at, bt) 327 case as && !bs: 328 SubSVU8(at[0], bt) 329 case !as && bs: 330 SubVSU8(at, bt[0]) 331 default: 332 VecSubU8(at, bt) 333 } 334 return 335 case Uint16: 336 at := a.Uint16s() 337 bt := b.Uint16s() 338 switch { 339 case as && bs: 340 VecSubU16(at, bt) 341 case as && !bs: 342 SubSVU16(at[0], bt) 343 case !as && bs: 344 SubVSU16(at, bt[0]) 345 default: 346 VecSubU16(at, bt) 347 } 348 return 349 case Uint32: 350 at := a.Uint32s() 351 bt := b.Uint32s() 352 switch { 353 case as && bs: 354 VecSubU32(at, bt) 355 case as && !bs: 356 SubSVU32(at[0], bt) 357 case !as && bs: 358 SubVSU32(at, bt[0]) 359 default: 360 VecSubU32(at, bt) 361 } 362 return 363 case Uint64: 364 at := a.Uint64s() 365 bt := b.Uint64s() 366 switch { 367 case as && bs: 368 VecSubU64(at, bt) 369 case as && !bs: 370 SubSVU64(at[0], bt) 371 case !as && bs: 372 SubVSU64(at, bt[0]) 373 default: 374 VecSubU64(at, bt) 375 } 376 return 377 case Float32: 378 at := a.Float32s() 379 bt := b.Float32s() 380 switch { 381 case as && bs: 382 VecSubF32(at, bt) 383 case as && !bs: 384 SubSVF32(at[0], bt) 385 case !as && bs: 386 SubVSF32(at, bt[0]) 387 default: 388 VecSubF32(at, bt) 389 } 390 return 391 case Float64: 392 at := a.Float64s() 393 bt := b.Float64s() 394 switch { 395 case as && bs: 396 VecSubF64(at, bt) 397 case as && !bs: 398 SubSVF64(at[0], bt) 399 case !as && bs: 400 SubVSF64(at, bt[0]) 401 default: 402 VecSubF64(at, bt) 403 } 404 return 405 case Complex64: 406 at := a.Complex64s() 407 bt := b.Complex64s() 408 switch { 409 case as && bs: 410 VecSubC64(at, bt) 411 case as && !bs: 412 SubSVC64(at[0], bt) 413 case !as && bs: 414 SubVSC64(at, bt[0]) 415 default: 416 VecSubC64(at, bt) 417 } 418 return 419 case Complex128: 420 at := a.Complex128s() 421 bt := b.Complex128s() 422 switch { 423 case as && bs: 424 VecSubC128(at, bt) 425 case as && !bs: 426 SubSVC128(at[0], bt) 427 case !as && bs: 428 SubVSC128(at, bt[0]) 429 default: 430 VecSubC128(at, bt) 431 } 432 return 433 default: 434 return errors.Errorf("Unsupported type %v for Sub", t) 435 } 436 } 437 438 func (e E) Mul(t reflect.Type, a *storage.Header, b *storage.Header) (err error) { 439 as := isScalar(a, t) 440 bs := isScalar(b, t) 441 442 switch t { 443 case Int: 444 at := a.Ints() 445 bt := b.Ints() 446 switch { 447 case as && bs: 448 VecMulI(at, bt) 449 case as && !bs: 450 MulSVI(at[0], bt) 451 case !as && bs: 452 MulVSI(at, bt[0]) 453 default: 454 VecMulI(at, bt) 455 } 456 return 457 case Int8: 458 at := a.Int8s() 459 bt := b.Int8s() 460 switch { 461 case as && bs: 462 VecMulI8(at, bt) 463 case as && !bs: 464 MulSVI8(at[0], bt) 465 case !as && bs: 466 MulVSI8(at, bt[0]) 467 default: 468 VecMulI8(at, bt) 469 } 470 return 471 case Int16: 472 at := a.Int16s() 473 bt := b.Int16s() 474 switch { 475 case as && bs: 476 VecMulI16(at, bt) 477 case as && !bs: 478 MulSVI16(at[0], bt) 479 case !as && bs: 480 MulVSI16(at, bt[0]) 481 default: 482 VecMulI16(at, bt) 483 } 484 return 485 case Int32: 486 at := a.Int32s() 487 bt := b.Int32s() 488 switch { 489 case as && bs: 490 VecMulI32(at, bt) 491 case as && !bs: 492 MulSVI32(at[0], bt) 493 case !as && bs: 494 MulVSI32(at, bt[0]) 495 default: 496 VecMulI32(at, bt) 497 } 498 return 499 case Int64: 500 at := a.Int64s() 501 bt := b.Int64s() 502 switch { 503 case as && bs: 504 VecMulI64(at, bt) 505 case as && !bs: 506 MulSVI64(at[0], bt) 507 case !as && bs: 508 MulVSI64(at, bt[0]) 509 default: 510 VecMulI64(at, bt) 511 } 512 return 513 case Uint: 514 at := a.Uints() 515 bt := b.Uints() 516 switch { 517 case as && bs: 518 VecMulU(at, bt) 519 case as && !bs: 520 MulSVU(at[0], bt) 521 case !as && bs: 522 MulVSU(at, bt[0]) 523 default: 524 VecMulU(at, bt) 525 } 526 return 527 case Uint8: 528 at := a.Uint8s() 529 bt := b.Uint8s() 530 switch { 531 case as && bs: 532 VecMulU8(at, bt) 533 case as && !bs: 534 MulSVU8(at[0], bt) 535 case !as && bs: 536 MulVSU8(at, bt[0]) 537 default: 538 VecMulU8(at, bt) 539 } 540 return 541 case Uint16: 542 at := a.Uint16s() 543 bt := b.Uint16s() 544 switch { 545 case as && bs: 546 VecMulU16(at, bt) 547 case as && !bs: 548 MulSVU16(at[0], bt) 549 case !as && bs: 550 MulVSU16(at, bt[0]) 551 default: 552 VecMulU16(at, bt) 553 } 554 return 555 case Uint32: 556 at := a.Uint32s() 557 bt := b.Uint32s() 558 switch { 559 case as && bs: 560 VecMulU32(at, bt) 561 case as && !bs: 562 MulSVU32(at[0], bt) 563 case !as && bs: 564 MulVSU32(at, bt[0]) 565 default: 566 VecMulU32(at, bt) 567 } 568 return 569 case Uint64: 570 at := a.Uint64s() 571 bt := b.Uint64s() 572 switch { 573 case as && bs: 574 VecMulU64(at, bt) 575 case as && !bs: 576 MulSVU64(at[0], bt) 577 case !as && bs: 578 MulVSU64(at, bt[0]) 579 default: 580 VecMulU64(at, bt) 581 } 582 return 583 case Float32: 584 at := a.Float32s() 585 bt := b.Float32s() 586 switch { 587 case as && bs: 588 VecMulF32(at, bt) 589 case as && !bs: 590 MulSVF32(at[0], bt) 591 case !as && bs: 592 MulVSF32(at, bt[0]) 593 default: 594 VecMulF32(at, bt) 595 } 596 return 597 case Float64: 598 at := a.Float64s() 599 bt := b.Float64s() 600 switch { 601 case as && bs: 602 VecMulF64(at, bt) 603 case as && !bs: 604 MulSVF64(at[0], bt) 605 case !as && bs: 606 MulVSF64(at, bt[0]) 607 default: 608 VecMulF64(at, bt) 609 } 610 return 611 case Complex64: 612 at := a.Complex64s() 613 bt := b.Complex64s() 614 switch { 615 case as && bs: 616 VecMulC64(at, bt) 617 case as && !bs: 618 MulSVC64(at[0], bt) 619 case !as && bs: 620 MulVSC64(at, bt[0]) 621 default: 622 VecMulC64(at, bt) 623 } 624 return 625 case Complex128: 626 at := a.Complex128s() 627 bt := b.Complex128s() 628 switch { 629 case as && bs: 630 VecMulC128(at, bt) 631 case as && !bs: 632 MulSVC128(at[0], bt) 633 case !as && bs: 634 MulVSC128(at, bt[0]) 635 default: 636 VecMulC128(at, bt) 637 } 638 return 639 default: 640 return errors.Errorf("Unsupported type %v for Mul", t) 641 } 642 } 643 644 func (e E) Div(t reflect.Type, a *storage.Header, b *storage.Header) (err error) { 645 as := isScalar(a, t) 646 bs := isScalar(b, t) 647 648 switch t { 649 case Int: 650 at := a.Ints() 651 bt := b.Ints() 652 switch { 653 case as && bs: 654 VecDivI(at, bt) 655 case as && !bs: 656 err = DivSVI(at[0], bt) 657 case !as && bs: 658 err = DivVSI(at, bt[0]) 659 default: 660 err = VecDivI(at, bt) 661 } 662 return 663 case Int8: 664 at := a.Int8s() 665 bt := b.Int8s() 666 switch { 667 case as && bs: 668 VecDivI8(at, bt) 669 case as && !bs: 670 err = DivSVI8(at[0], bt) 671 case !as && bs: 672 err = DivVSI8(at, bt[0]) 673 default: 674 err = VecDivI8(at, bt) 675 } 676 return 677 case Int16: 678 at := a.Int16s() 679 bt := b.Int16s() 680 switch { 681 case as && bs: 682 VecDivI16(at, bt) 683 case as && !bs: 684 err = DivSVI16(at[0], bt) 685 case !as && bs: 686 err = DivVSI16(at, bt[0]) 687 default: 688 err = VecDivI16(at, bt) 689 } 690 return 691 case Int32: 692 at := a.Int32s() 693 bt := b.Int32s() 694 switch { 695 case as && bs: 696 VecDivI32(at, bt) 697 case as && !bs: 698 err = DivSVI32(at[0], bt) 699 case !as && bs: 700 err = DivVSI32(at, bt[0]) 701 default: 702 err = VecDivI32(at, bt) 703 } 704 return 705 case Int64: 706 at := a.Int64s() 707 bt := b.Int64s() 708 switch { 709 case as && bs: 710 VecDivI64(at, bt) 711 case as && !bs: 712 err = DivSVI64(at[0], bt) 713 case !as && bs: 714 err = DivVSI64(at, bt[0]) 715 default: 716 err = VecDivI64(at, bt) 717 } 718 return 719 case Uint: 720 at := a.Uints() 721 bt := b.Uints() 722 switch { 723 case as && bs: 724 VecDivU(at, bt) 725 case as && !bs: 726 err = DivSVU(at[0], bt) 727 case !as && bs: 728 err = DivVSU(at, bt[0]) 729 default: 730 err = VecDivU(at, bt) 731 } 732 return 733 case Uint8: 734 at := a.Uint8s() 735 bt := b.Uint8s() 736 switch { 737 case as && bs: 738 VecDivU8(at, bt) 739 case as && !bs: 740 err = DivSVU8(at[0], bt) 741 case !as && bs: 742 err = DivVSU8(at, bt[0]) 743 default: 744 err = VecDivU8(at, bt) 745 } 746 return 747 case Uint16: 748 at := a.Uint16s() 749 bt := b.Uint16s() 750 switch { 751 case as && bs: 752 VecDivU16(at, bt) 753 case as && !bs: 754 err = DivSVU16(at[0], bt) 755 case !as && bs: 756 err = DivVSU16(at, bt[0]) 757 default: 758 err = VecDivU16(at, bt) 759 } 760 return 761 case Uint32: 762 at := a.Uint32s() 763 bt := b.Uint32s() 764 switch { 765 case as && bs: 766 VecDivU32(at, bt) 767 case as && !bs: 768 err = DivSVU32(at[0], bt) 769 case !as && bs: 770 err = DivVSU32(at, bt[0]) 771 default: 772 err = VecDivU32(at, bt) 773 } 774 return 775 case Uint64: 776 at := a.Uint64s() 777 bt := b.Uint64s() 778 switch { 779 case as && bs: 780 VecDivU64(at, bt) 781 case as && !bs: 782 err = DivSVU64(at[0], bt) 783 case !as && bs: 784 err = DivVSU64(at, bt[0]) 785 default: 786 err = VecDivU64(at, bt) 787 } 788 return 789 case Float32: 790 at := a.Float32s() 791 bt := b.Float32s() 792 switch { 793 case as && bs: 794 VecDivF32(at, bt) 795 case as && !bs: 796 DivSVF32(at[0], bt) 797 case !as && bs: 798 DivVSF32(at, bt[0]) 799 default: 800 VecDivF32(at, bt) 801 } 802 return 803 case Float64: 804 at := a.Float64s() 805 bt := b.Float64s() 806 switch { 807 case as && bs: 808 VecDivF64(at, bt) 809 case as && !bs: 810 DivSVF64(at[0], bt) 811 case !as && bs: 812 DivVSF64(at, bt[0]) 813 default: 814 VecDivF64(at, bt) 815 } 816 return 817 case Complex64: 818 at := a.Complex64s() 819 bt := b.Complex64s() 820 switch { 821 case as && bs: 822 VecDivC64(at, bt) 823 case as && !bs: 824 DivSVC64(at[0], bt) 825 case !as && bs: 826 DivVSC64(at, bt[0]) 827 default: 828 VecDivC64(at, bt) 829 } 830 return 831 case Complex128: 832 at := a.Complex128s() 833 bt := b.Complex128s() 834 switch { 835 case as && bs: 836 VecDivC128(at, bt) 837 case as && !bs: 838 DivSVC128(at[0], bt) 839 case !as && bs: 840 DivVSC128(at, bt[0]) 841 default: 842 VecDivC128(at, bt) 843 } 844 return 845 default: 846 return errors.Errorf("Unsupported type %v for Div", t) 847 } 848 } 849 850 func (e E) Pow(t reflect.Type, a *storage.Header, b *storage.Header) (err error) { 851 as := isScalar(a, t) 852 bs := isScalar(b, t) 853 854 switch t { 855 case Float32: 856 at := a.Float32s() 857 bt := b.Float32s() 858 switch { 859 case as && bs: 860 VecPowF32(at, bt) 861 case as && !bs: 862 PowSVF32(at[0], bt) 863 case !as && bs: 864 PowVSF32(at, bt[0]) 865 default: 866 VecPowF32(at, bt) 867 } 868 return 869 case Float64: 870 at := a.Float64s() 871 bt := b.Float64s() 872 switch { 873 case as && bs: 874 VecPowF64(at, bt) 875 case as && !bs: 876 PowSVF64(at[0], bt) 877 case !as && bs: 878 PowVSF64(at, bt[0]) 879 default: 880 VecPowF64(at, bt) 881 } 882 return 883 case Complex64: 884 at := a.Complex64s() 885 bt := b.Complex64s() 886 switch { 887 case as && bs: 888 VecPowC64(at, bt) 889 case as && !bs: 890 PowSVC64(at[0], bt) 891 case !as && bs: 892 PowVSC64(at, bt[0]) 893 default: 894 VecPowC64(at, bt) 895 } 896 return 897 case Complex128: 898 at := a.Complex128s() 899 bt := b.Complex128s() 900 switch { 901 case as && bs: 902 VecPowC128(at, bt) 903 case as && !bs: 904 PowSVC128(at[0], bt) 905 case !as && bs: 906 PowVSC128(at, bt[0]) 907 default: 908 VecPowC128(at, bt) 909 } 910 return 911 default: 912 return errors.Errorf("Unsupported type %v for Pow", t) 913 } 914 } 915 916 func (e E) Mod(t reflect.Type, a *storage.Header, b *storage.Header) (err error) { 917 as := isScalar(a, t) 918 bs := isScalar(b, t) 919 920 switch t { 921 case Int: 922 at := a.Ints() 923 bt := b.Ints() 924 switch { 925 case as && bs: 926 VecModI(at, bt) 927 case as && !bs: 928 ModSVI(at[0], bt) 929 case !as && bs: 930 ModVSI(at, bt[0]) 931 default: 932 VecModI(at, bt) 933 } 934 return 935 case Int8: 936 at := a.Int8s() 937 bt := b.Int8s() 938 switch { 939 case as && bs: 940 VecModI8(at, bt) 941 case as && !bs: 942 ModSVI8(at[0], bt) 943 case !as && bs: 944 ModVSI8(at, bt[0]) 945 default: 946 VecModI8(at, bt) 947 } 948 return 949 case Int16: 950 at := a.Int16s() 951 bt := b.Int16s() 952 switch { 953 case as && bs: 954 VecModI16(at, bt) 955 case as && !bs: 956 ModSVI16(at[0], bt) 957 case !as && bs: 958 ModVSI16(at, bt[0]) 959 default: 960 VecModI16(at, bt) 961 } 962 return 963 case Int32: 964 at := a.Int32s() 965 bt := b.Int32s() 966 switch { 967 case as && bs: 968 VecModI32(at, bt) 969 case as && !bs: 970 ModSVI32(at[0], bt) 971 case !as && bs: 972 ModVSI32(at, bt[0]) 973 default: 974 VecModI32(at, bt) 975 } 976 return 977 case Int64: 978 at := a.Int64s() 979 bt := b.Int64s() 980 switch { 981 case as && bs: 982 VecModI64(at, bt) 983 case as && !bs: 984 ModSVI64(at[0], bt) 985 case !as && bs: 986 ModVSI64(at, bt[0]) 987 default: 988 VecModI64(at, bt) 989 } 990 return 991 case Uint: 992 at := a.Uints() 993 bt := b.Uints() 994 switch { 995 case as && bs: 996 VecModU(at, bt) 997 case as && !bs: 998 ModSVU(at[0], bt) 999 case !as && bs: 1000 ModVSU(at, bt[0]) 1001 default: 1002 VecModU(at, bt) 1003 } 1004 return 1005 case Uint8: 1006 at := a.Uint8s() 1007 bt := b.Uint8s() 1008 switch { 1009 case as && bs: 1010 VecModU8(at, bt) 1011 case as && !bs: 1012 ModSVU8(at[0], bt) 1013 case !as && bs: 1014 ModVSU8(at, bt[0]) 1015 default: 1016 VecModU8(at, bt) 1017 } 1018 return 1019 case Uint16: 1020 at := a.Uint16s() 1021 bt := b.Uint16s() 1022 switch { 1023 case as && bs: 1024 VecModU16(at, bt) 1025 case as && !bs: 1026 ModSVU16(at[0], bt) 1027 case !as && bs: 1028 ModVSU16(at, bt[0]) 1029 default: 1030 VecModU16(at, bt) 1031 } 1032 return 1033 case Uint32: 1034 at := a.Uint32s() 1035 bt := b.Uint32s() 1036 switch { 1037 case as && bs: 1038 VecModU32(at, bt) 1039 case as && !bs: 1040 ModSVU32(at[0], bt) 1041 case !as && bs: 1042 ModVSU32(at, bt[0]) 1043 default: 1044 VecModU32(at, bt) 1045 } 1046 return 1047 case Uint64: 1048 at := a.Uint64s() 1049 bt := b.Uint64s() 1050 switch { 1051 case as && bs: 1052 VecModU64(at, bt) 1053 case as && !bs: 1054 ModSVU64(at[0], bt) 1055 case !as && bs: 1056 ModVSU64(at, bt[0]) 1057 default: 1058 VecModU64(at, bt) 1059 } 1060 return 1061 case Float32: 1062 at := a.Float32s() 1063 bt := b.Float32s() 1064 switch { 1065 case as && bs: 1066 VecModF32(at, bt) 1067 case as && !bs: 1068 ModSVF32(at[0], bt) 1069 case !as && bs: 1070 ModVSF32(at, bt[0]) 1071 default: 1072 VecModF32(at, bt) 1073 } 1074 return 1075 case Float64: 1076 at := a.Float64s() 1077 bt := b.Float64s() 1078 switch { 1079 case as && bs: 1080 VecModF64(at, bt) 1081 case as && !bs: 1082 ModSVF64(at[0], bt) 1083 case !as && bs: 1084 ModVSF64(at, bt[0]) 1085 default: 1086 VecModF64(at, bt) 1087 } 1088 return 1089 default: 1090 return errors.Errorf("Unsupported type %v for Mod", t) 1091 } 1092 } 1093 1094 func (e E) AddIncr(t reflect.Type, a *storage.Header, b *storage.Header, incr *storage.Header) (err error) { 1095 as := isScalar(a, t) 1096 bs := isScalar(b, t) 1097 is := isScalar(incr, t) 1098 if ((as && !bs) || (bs && !as)) && is { 1099 return errors.Errorf("Cannot increment on scalar increment. a: %d, b %d", a.TypedLen(t), b.TypedLen(t)) 1100 } 1101 1102 switch t { 1103 case Int: 1104 at := a.Ints() 1105 bt := b.Ints() 1106 it := incr.Ints() 1107 1108 switch { 1109 case as && bs: 1110 VecAddI(at, bt) 1111 if !is { 1112 return e.Add(t, incr, a) 1113 } 1114 it[0] += at[0] 1115 case as && !bs: 1116 AddIncrSVI(at[0], bt, it) 1117 case !as && bs: 1118 AddIncrVSI(at, bt[0], it) 1119 default: 1120 AddIncrI(at, bt, it) 1121 } 1122 return 1123 case Int8: 1124 at := a.Int8s() 1125 bt := b.Int8s() 1126 it := incr.Int8s() 1127 1128 switch { 1129 case as && bs: 1130 VecAddI8(at, bt) 1131 if !is { 1132 return e.Add(t, incr, a) 1133 } 1134 it[0] += at[0] 1135 case as && !bs: 1136 AddIncrSVI8(at[0], bt, it) 1137 case !as && bs: 1138 AddIncrVSI8(at, bt[0], it) 1139 default: 1140 AddIncrI8(at, bt, it) 1141 } 1142 return 1143 case Int16: 1144 at := a.Int16s() 1145 bt := b.Int16s() 1146 it := incr.Int16s() 1147 1148 switch { 1149 case as && bs: 1150 VecAddI16(at, bt) 1151 if !is { 1152 return e.Add(t, incr, a) 1153 } 1154 it[0] += at[0] 1155 case as && !bs: 1156 AddIncrSVI16(at[0], bt, it) 1157 case !as && bs: 1158 AddIncrVSI16(at, bt[0], it) 1159 default: 1160 AddIncrI16(at, bt, it) 1161 } 1162 return 1163 case Int32: 1164 at := a.Int32s() 1165 bt := b.Int32s() 1166 it := incr.Int32s() 1167 1168 switch { 1169 case as && bs: 1170 VecAddI32(at, bt) 1171 if !is { 1172 return e.Add(t, incr, a) 1173 } 1174 it[0] += at[0] 1175 case as && !bs: 1176 AddIncrSVI32(at[0], bt, it) 1177 case !as && bs: 1178 AddIncrVSI32(at, bt[0], it) 1179 default: 1180 AddIncrI32(at, bt, it) 1181 } 1182 return 1183 case Int64: 1184 at := a.Int64s() 1185 bt := b.Int64s() 1186 it := incr.Int64s() 1187 1188 switch { 1189 case as && bs: 1190 VecAddI64(at, bt) 1191 if !is { 1192 return e.Add(t, incr, a) 1193 } 1194 it[0] += at[0] 1195 case as && !bs: 1196 AddIncrSVI64(at[0], bt, it) 1197 case !as && bs: 1198 AddIncrVSI64(at, bt[0], it) 1199 default: 1200 AddIncrI64(at, bt, it) 1201 } 1202 return 1203 case Uint: 1204 at := a.Uints() 1205 bt := b.Uints() 1206 it := incr.Uints() 1207 1208 switch { 1209 case as && bs: 1210 VecAddU(at, bt) 1211 if !is { 1212 return e.Add(t, incr, a) 1213 } 1214 it[0] += at[0] 1215 case as && !bs: 1216 AddIncrSVU(at[0], bt, it) 1217 case !as && bs: 1218 AddIncrVSU(at, bt[0], it) 1219 default: 1220 AddIncrU(at, bt, it) 1221 } 1222 return 1223 case Uint8: 1224 at := a.Uint8s() 1225 bt := b.Uint8s() 1226 it := incr.Uint8s() 1227 1228 switch { 1229 case as && bs: 1230 VecAddU8(at, bt) 1231 if !is { 1232 return e.Add(t, incr, a) 1233 } 1234 it[0] += at[0] 1235 case as && !bs: 1236 AddIncrSVU8(at[0], bt, it) 1237 case !as && bs: 1238 AddIncrVSU8(at, bt[0], it) 1239 default: 1240 AddIncrU8(at, bt, it) 1241 } 1242 return 1243 case Uint16: 1244 at := a.Uint16s() 1245 bt := b.Uint16s() 1246 it := incr.Uint16s() 1247 1248 switch { 1249 case as && bs: 1250 VecAddU16(at, bt) 1251 if !is { 1252 return e.Add(t, incr, a) 1253 } 1254 it[0] += at[0] 1255 case as && !bs: 1256 AddIncrSVU16(at[0], bt, it) 1257 case !as && bs: 1258 AddIncrVSU16(at, bt[0], it) 1259 default: 1260 AddIncrU16(at, bt, it) 1261 } 1262 return 1263 case Uint32: 1264 at := a.Uint32s() 1265 bt := b.Uint32s() 1266 it := incr.Uint32s() 1267 1268 switch { 1269 case as && bs: 1270 VecAddU32(at, bt) 1271 if !is { 1272 return e.Add(t, incr, a) 1273 } 1274 it[0] += at[0] 1275 case as && !bs: 1276 AddIncrSVU32(at[0], bt, it) 1277 case !as && bs: 1278 AddIncrVSU32(at, bt[0], it) 1279 default: 1280 AddIncrU32(at, bt, it) 1281 } 1282 return 1283 case Uint64: 1284 at := a.Uint64s() 1285 bt := b.Uint64s() 1286 it := incr.Uint64s() 1287 1288 switch { 1289 case as && bs: 1290 VecAddU64(at, bt) 1291 if !is { 1292 return e.Add(t, incr, a) 1293 } 1294 it[0] += at[0] 1295 case as && !bs: 1296 AddIncrSVU64(at[0], bt, it) 1297 case !as && bs: 1298 AddIncrVSU64(at, bt[0], it) 1299 default: 1300 AddIncrU64(at, bt, it) 1301 } 1302 return 1303 case Float32: 1304 at := a.Float32s() 1305 bt := b.Float32s() 1306 it := incr.Float32s() 1307 1308 switch { 1309 case as && bs: 1310 VecAddF32(at, bt) 1311 if !is { 1312 return e.Add(t, incr, a) 1313 } 1314 it[0] += at[0] 1315 case as && !bs: 1316 AddIncrSVF32(at[0], bt, it) 1317 case !as && bs: 1318 AddIncrVSF32(at, bt[0], it) 1319 default: 1320 AddIncrF32(at, bt, it) 1321 } 1322 return 1323 case Float64: 1324 at := a.Float64s() 1325 bt := b.Float64s() 1326 it := incr.Float64s() 1327 1328 switch { 1329 case as && bs: 1330 VecAddF64(at, bt) 1331 if !is { 1332 return e.Add(t, incr, a) 1333 } 1334 it[0] += at[0] 1335 case as && !bs: 1336 AddIncrSVF64(at[0], bt, it) 1337 case !as && bs: 1338 AddIncrVSF64(at, bt[0], it) 1339 default: 1340 AddIncrF64(at, bt, it) 1341 } 1342 return 1343 case Complex64: 1344 at := a.Complex64s() 1345 bt := b.Complex64s() 1346 it := incr.Complex64s() 1347 1348 switch { 1349 case as && bs: 1350 VecAddC64(at, bt) 1351 if !is { 1352 return e.Add(t, incr, a) 1353 } 1354 it[0] += at[0] 1355 case as && !bs: 1356 AddIncrSVC64(at[0], bt, it) 1357 case !as && bs: 1358 AddIncrVSC64(at, bt[0], it) 1359 default: 1360 AddIncrC64(at, bt, it) 1361 } 1362 return 1363 case Complex128: 1364 at := a.Complex128s() 1365 bt := b.Complex128s() 1366 it := incr.Complex128s() 1367 1368 switch { 1369 case as && bs: 1370 VecAddC128(at, bt) 1371 if !is { 1372 return e.Add(t, incr, a) 1373 } 1374 it[0] += at[0] 1375 case as && !bs: 1376 AddIncrSVC128(at[0], bt, it) 1377 case !as && bs: 1378 AddIncrVSC128(at, bt[0], it) 1379 default: 1380 AddIncrC128(at, bt, it) 1381 } 1382 return 1383 case String: 1384 at := a.Strings() 1385 bt := b.Strings() 1386 it := incr.Strings() 1387 1388 switch { 1389 case as && bs: 1390 VecAddStr(at, bt) 1391 if !is { 1392 return e.Add(t, incr, a) 1393 } 1394 it[0] += at[0] 1395 case as && !bs: 1396 AddIncrSVStr(at[0], bt, it) 1397 case !as && bs: 1398 AddIncrVSStr(at, bt[0], it) 1399 default: 1400 AddIncrStr(at, bt, it) 1401 } 1402 return 1403 default: 1404 return errors.Errorf("Unsupported type %v for Add", t) 1405 } 1406 } 1407 1408 func (e E) SubIncr(t reflect.Type, a *storage.Header, b *storage.Header, incr *storage.Header) (err error) { 1409 as := isScalar(a, t) 1410 bs := isScalar(b, t) 1411 is := isScalar(incr, t) 1412 if ((as && !bs) || (bs && !as)) && is { 1413 return errors.Errorf("Cannot increment on scalar increment. a: %d, b %d", a.TypedLen(t), b.TypedLen(t)) 1414 } 1415 1416 switch t { 1417 case Int: 1418 at := a.Ints() 1419 bt := b.Ints() 1420 it := incr.Ints() 1421 1422 switch { 1423 case as && bs: 1424 VecSubI(at, bt) 1425 if !is { 1426 return e.Add(t, incr, a) 1427 } 1428 it[0] += at[0] 1429 case as && !bs: 1430 SubIncrSVI(at[0], bt, it) 1431 case !as && bs: 1432 SubIncrVSI(at, bt[0], it) 1433 default: 1434 SubIncrI(at, bt, it) 1435 } 1436 return 1437 case Int8: 1438 at := a.Int8s() 1439 bt := b.Int8s() 1440 it := incr.Int8s() 1441 1442 switch { 1443 case as && bs: 1444 VecSubI8(at, bt) 1445 if !is { 1446 return e.Add(t, incr, a) 1447 } 1448 it[0] += at[0] 1449 case as && !bs: 1450 SubIncrSVI8(at[0], bt, it) 1451 case !as && bs: 1452 SubIncrVSI8(at, bt[0], it) 1453 default: 1454 SubIncrI8(at, bt, it) 1455 } 1456 return 1457 case Int16: 1458 at := a.Int16s() 1459 bt := b.Int16s() 1460 it := incr.Int16s() 1461 1462 switch { 1463 case as && bs: 1464 VecSubI16(at, bt) 1465 if !is { 1466 return e.Add(t, incr, a) 1467 } 1468 it[0] += at[0] 1469 case as && !bs: 1470 SubIncrSVI16(at[0], bt, it) 1471 case !as && bs: 1472 SubIncrVSI16(at, bt[0], it) 1473 default: 1474 SubIncrI16(at, bt, it) 1475 } 1476 return 1477 case Int32: 1478 at := a.Int32s() 1479 bt := b.Int32s() 1480 it := incr.Int32s() 1481 1482 switch { 1483 case as && bs: 1484 VecSubI32(at, bt) 1485 if !is { 1486 return e.Add(t, incr, a) 1487 } 1488 it[0] += at[0] 1489 case as && !bs: 1490 SubIncrSVI32(at[0], bt, it) 1491 case !as && bs: 1492 SubIncrVSI32(at, bt[0], it) 1493 default: 1494 SubIncrI32(at, bt, it) 1495 } 1496 return 1497 case Int64: 1498 at := a.Int64s() 1499 bt := b.Int64s() 1500 it := incr.Int64s() 1501 1502 switch { 1503 case as && bs: 1504 VecSubI64(at, bt) 1505 if !is { 1506 return e.Add(t, incr, a) 1507 } 1508 it[0] += at[0] 1509 case as && !bs: 1510 SubIncrSVI64(at[0], bt, it) 1511 case !as && bs: 1512 SubIncrVSI64(at, bt[0], it) 1513 default: 1514 SubIncrI64(at, bt, it) 1515 } 1516 return 1517 case Uint: 1518 at := a.Uints() 1519 bt := b.Uints() 1520 it := incr.Uints() 1521 1522 switch { 1523 case as && bs: 1524 VecSubU(at, bt) 1525 if !is { 1526 return e.Add(t, incr, a) 1527 } 1528 it[0] += at[0] 1529 case as && !bs: 1530 SubIncrSVU(at[0], bt, it) 1531 case !as && bs: 1532 SubIncrVSU(at, bt[0], it) 1533 default: 1534 SubIncrU(at, bt, it) 1535 } 1536 return 1537 case Uint8: 1538 at := a.Uint8s() 1539 bt := b.Uint8s() 1540 it := incr.Uint8s() 1541 1542 switch { 1543 case as && bs: 1544 VecSubU8(at, bt) 1545 if !is { 1546 return e.Add(t, incr, a) 1547 } 1548 it[0] += at[0] 1549 case as && !bs: 1550 SubIncrSVU8(at[0], bt, it) 1551 case !as && bs: 1552 SubIncrVSU8(at, bt[0], it) 1553 default: 1554 SubIncrU8(at, bt, it) 1555 } 1556 return 1557 case Uint16: 1558 at := a.Uint16s() 1559 bt := b.Uint16s() 1560 it := incr.Uint16s() 1561 1562 switch { 1563 case as && bs: 1564 VecSubU16(at, bt) 1565 if !is { 1566 return e.Add(t, incr, a) 1567 } 1568 it[0] += at[0] 1569 case as && !bs: 1570 SubIncrSVU16(at[0], bt, it) 1571 case !as && bs: 1572 SubIncrVSU16(at, bt[0], it) 1573 default: 1574 SubIncrU16(at, bt, it) 1575 } 1576 return 1577 case Uint32: 1578 at := a.Uint32s() 1579 bt := b.Uint32s() 1580 it := incr.Uint32s() 1581 1582 switch { 1583 case as && bs: 1584 VecSubU32(at, bt) 1585 if !is { 1586 return e.Add(t, incr, a) 1587 } 1588 it[0] += at[0] 1589 case as && !bs: 1590 SubIncrSVU32(at[0], bt, it) 1591 case !as && bs: 1592 SubIncrVSU32(at, bt[0], it) 1593 default: 1594 SubIncrU32(at, bt, it) 1595 } 1596 return 1597 case Uint64: 1598 at := a.Uint64s() 1599 bt := b.Uint64s() 1600 it := incr.Uint64s() 1601 1602 switch { 1603 case as && bs: 1604 VecSubU64(at, bt) 1605 if !is { 1606 return e.Add(t, incr, a) 1607 } 1608 it[0] += at[0] 1609 case as && !bs: 1610 SubIncrSVU64(at[0], bt, it) 1611 case !as && bs: 1612 SubIncrVSU64(at, bt[0], it) 1613 default: 1614 SubIncrU64(at, bt, it) 1615 } 1616 return 1617 case Float32: 1618 at := a.Float32s() 1619 bt := b.Float32s() 1620 it := incr.Float32s() 1621 1622 switch { 1623 case as && bs: 1624 VecSubF32(at, bt) 1625 if !is { 1626 return e.Add(t, incr, a) 1627 } 1628 it[0] += at[0] 1629 case as && !bs: 1630 SubIncrSVF32(at[0], bt, it) 1631 case !as && bs: 1632 SubIncrVSF32(at, bt[0], it) 1633 default: 1634 SubIncrF32(at, bt, it) 1635 } 1636 return 1637 case Float64: 1638 at := a.Float64s() 1639 bt := b.Float64s() 1640 it := incr.Float64s() 1641 1642 switch { 1643 case as && bs: 1644 VecSubF64(at, bt) 1645 if !is { 1646 return e.Add(t, incr, a) 1647 } 1648 it[0] += at[0] 1649 case as && !bs: 1650 SubIncrSVF64(at[0], bt, it) 1651 case !as && bs: 1652 SubIncrVSF64(at, bt[0], it) 1653 default: 1654 SubIncrF64(at, bt, it) 1655 } 1656 return 1657 case Complex64: 1658 at := a.Complex64s() 1659 bt := b.Complex64s() 1660 it := incr.Complex64s() 1661 1662 switch { 1663 case as && bs: 1664 VecSubC64(at, bt) 1665 if !is { 1666 return e.Add(t, incr, a) 1667 } 1668 it[0] += at[0] 1669 case as && !bs: 1670 SubIncrSVC64(at[0], bt, it) 1671 case !as && bs: 1672 SubIncrVSC64(at, bt[0], it) 1673 default: 1674 SubIncrC64(at, bt, it) 1675 } 1676 return 1677 case Complex128: 1678 at := a.Complex128s() 1679 bt := b.Complex128s() 1680 it := incr.Complex128s() 1681 1682 switch { 1683 case as && bs: 1684 VecSubC128(at, bt) 1685 if !is { 1686 return e.Add(t, incr, a) 1687 } 1688 it[0] += at[0] 1689 case as && !bs: 1690 SubIncrSVC128(at[0], bt, it) 1691 case !as && bs: 1692 SubIncrVSC128(at, bt[0], it) 1693 default: 1694 SubIncrC128(at, bt, it) 1695 } 1696 return 1697 default: 1698 return errors.Errorf("Unsupported type %v for Sub", t) 1699 } 1700 } 1701 1702 func (e E) MulIncr(t reflect.Type, a *storage.Header, b *storage.Header, incr *storage.Header) (err error) { 1703 as := isScalar(a, t) 1704 bs := isScalar(b, t) 1705 is := isScalar(incr, t) 1706 if ((as && !bs) || (bs && !as)) && is { 1707 return errors.Errorf("Cannot increment on scalar increment. a: %d, b %d", a.TypedLen(t), b.TypedLen(t)) 1708 } 1709 1710 switch t { 1711 case Int: 1712 at := a.Ints() 1713 bt := b.Ints() 1714 it := incr.Ints() 1715 1716 switch { 1717 case as && bs: 1718 VecMulI(at, bt) 1719 if !is { 1720 return e.Add(t, incr, a) 1721 } 1722 it[0] += at[0] 1723 case as && !bs: 1724 MulIncrSVI(at[0], bt, it) 1725 case !as && bs: 1726 MulIncrVSI(at, bt[0], it) 1727 default: 1728 MulIncrI(at, bt, it) 1729 } 1730 return 1731 case Int8: 1732 at := a.Int8s() 1733 bt := b.Int8s() 1734 it := incr.Int8s() 1735 1736 switch { 1737 case as && bs: 1738 VecMulI8(at, bt) 1739 if !is { 1740 return e.Add(t, incr, a) 1741 } 1742 it[0] += at[0] 1743 case as && !bs: 1744 MulIncrSVI8(at[0], bt, it) 1745 case !as && bs: 1746 MulIncrVSI8(at, bt[0], it) 1747 default: 1748 MulIncrI8(at, bt, it) 1749 } 1750 return 1751 case Int16: 1752 at := a.Int16s() 1753 bt := b.Int16s() 1754 it := incr.Int16s() 1755 1756 switch { 1757 case as && bs: 1758 VecMulI16(at, bt) 1759 if !is { 1760 return e.Add(t, incr, a) 1761 } 1762 it[0] += at[0] 1763 case as && !bs: 1764 MulIncrSVI16(at[0], bt, it) 1765 case !as && bs: 1766 MulIncrVSI16(at, bt[0], it) 1767 default: 1768 MulIncrI16(at, bt, it) 1769 } 1770 return 1771 case Int32: 1772 at := a.Int32s() 1773 bt := b.Int32s() 1774 it := incr.Int32s() 1775 1776 switch { 1777 case as && bs: 1778 VecMulI32(at, bt) 1779 if !is { 1780 return e.Add(t, incr, a) 1781 } 1782 it[0] += at[0] 1783 case as && !bs: 1784 MulIncrSVI32(at[0], bt, it) 1785 case !as && bs: 1786 MulIncrVSI32(at, bt[0], it) 1787 default: 1788 MulIncrI32(at, bt, it) 1789 } 1790 return 1791 case Int64: 1792 at := a.Int64s() 1793 bt := b.Int64s() 1794 it := incr.Int64s() 1795 1796 switch { 1797 case as && bs: 1798 VecMulI64(at, bt) 1799 if !is { 1800 return e.Add(t, incr, a) 1801 } 1802 it[0] += at[0] 1803 case as && !bs: 1804 MulIncrSVI64(at[0], bt, it) 1805 case !as && bs: 1806 MulIncrVSI64(at, bt[0], it) 1807 default: 1808 MulIncrI64(at, bt, it) 1809 } 1810 return 1811 case Uint: 1812 at := a.Uints() 1813 bt := b.Uints() 1814 it := incr.Uints() 1815 1816 switch { 1817 case as && bs: 1818 VecMulU(at, bt) 1819 if !is { 1820 return e.Add(t, incr, a) 1821 } 1822 it[0] += at[0] 1823 case as && !bs: 1824 MulIncrSVU(at[0], bt, it) 1825 case !as && bs: 1826 MulIncrVSU(at, bt[0], it) 1827 default: 1828 MulIncrU(at, bt, it) 1829 } 1830 return 1831 case Uint8: 1832 at := a.Uint8s() 1833 bt := b.Uint8s() 1834 it := incr.Uint8s() 1835 1836 switch { 1837 case as && bs: 1838 VecMulU8(at, bt) 1839 if !is { 1840 return e.Add(t, incr, a) 1841 } 1842 it[0] += at[0] 1843 case as && !bs: 1844 MulIncrSVU8(at[0], bt, it) 1845 case !as && bs: 1846 MulIncrVSU8(at, bt[0], it) 1847 default: 1848 MulIncrU8(at, bt, it) 1849 } 1850 return 1851 case Uint16: 1852 at := a.Uint16s() 1853 bt := b.Uint16s() 1854 it := incr.Uint16s() 1855 1856 switch { 1857 case as && bs: 1858 VecMulU16(at, bt) 1859 if !is { 1860 return e.Add(t, incr, a) 1861 } 1862 it[0] += at[0] 1863 case as && !bs: 1864 MulIncrSVU16(at[0], bt, it) 1865 case !as && bs: 1866 MulIncrVSU16(at, bt[0], it) 1867 default: 1868 MulIncrU16(at, bt, it) 1869 } 1870 return 1871 case Uint32: 1872 at := a.Uint32s() 1873 bt := b.Uint32s() 1874 it := incr.Uint32s() 1875 1876 switch { 1877 case as && bs: 1878 VecMulU32(at, bt) 1879 if !is { 1880 return e.Add(t, incr, a) 1881 } 1882 it[0] += at[0] 1883 case as && !bs: 1884 MulIncrSVU32(at[0], bt, it) 1885 case !as && bs: 1886 MulIncrVSU32(at, bt[0], it) 1887 default: 1888 MulIncrU32(at, bt, it) 1889 } 1890 return 1891 case Uint64: 1892 at := a.Uint64s() 1893 bt := b.Uint64s() 1894 it := incr.Uint64s() 1895 1896 switch { 1897 case as && bs: 1898 VecMulU64(at, bt) 1899 if !is { 1900 return e.Add(t, incr, a) 1901 } 1902 it[0] += at[0] 1903 case as && !bs: 1904 MulIncrSVU64(at[0], bt, it) 1905 case !as && bs: 1906 MulIncrVSU64(at, bt[0], it) 1907 default: 1908 MulIncrU64(at, bt, it) 1909 } 1910 return 1911 case Float32: 1912 at := a.Float32s() 1913 bt := b.Float32s() 1914 it := incr.Float32s() 1915 1916 switch { 1917 case as && bs: 1918 VecMulF32(at, bt) 1919 if !is { 1920 return e.Add(t, incr, a) 1921 } 1922 it[0] += at[0] 1923 case as && !bs: 1924 MulIncrSVF32(at[0], bt, it) 1925 case !as && bs: 1926 MulIncrVSF32(at, bt[0], it) 1927 default: 1928 MulIncrF32(at, bt, it) 1929 } 1930 return 1931 case Float64: 1932 at := a.Float64s() 1933 bt := b.Float64s() 1934 it := incr.Float64s() 1935 1936 switch { 1937 case as && bs: 1938 VecMulF64(at, bt) 1939 if !is { 1940 return e.Add(t, incr, a) 1941 } 1942 it[0] += at[0] 1943 case as && !bs: 1944 MulIncrSVF64(at[0], bt, it) 1945 case !as && bs: 1946 MulIncrVSF64(at, bt[0], it) 1947 default: 1948 MulIncrF64(at, bt, it) 1949 } 1950 return 1951 case Complex64: 1952 at := a.Complex64s() 1953 bt := b.Complex64s() 1954 it := incr.Complex64s() 1955 1956 switch { 1957 case as && bs: 1958 VecMulC64(at, bt) 1959 if !is { 1960 return e.Add(t, incr, a) 1961 } 1962 it[0] += at[0] 1963 case as && !bs: 1964 MulIncrSVC64(at[0], bt, it) 1965 case !as && bs: 1966 MulIncrVSC64(at, bt[0], it) 1967 default: 1968 MulIncrC64(at, bt, it) 1969 } 1970 return 1971 case Complex128: 1972 at := a.Complex128s() 1973 bt := b.Complex128s() 1974 it := incr.Complex128s() 1975 1976 switch { 1977 case as && bs: 1978 VecMulC128(at, bt) 1979 if !is { 1980 return e.Add(t, incr, a) 1981 } 1982 it[0] += at[0] 1983 case as && !bs: 1984 MulIncrSVC128(at[0], bt, it) 1985 case !as && bs: 1986 MulIncrVSC128(at, bt[0], it) 1987 default: 1988 MulIncrC128(at, bt, it) 1989 } 1990 return 1991 default: 1992 return errors.Errorf("Unsupported type %v for Mul", t) 1993 } 1994 } 1995 1996 func (e E) DivIncr(t reflect.Type, a *storage.Header, b *storage.Header, incr *storage.Header) (err error) { 1997 as := isScalar(a, t) 1998 bs := isScalar(b, t) 1999 is := isScalar(incr, t) 2000 if ((as && !bs) || (bs && !as)) && is { 2001 return errors.Errorf("Cannot increment on scalar increment. a: %d, b %d", a.TypedLen(t), b.TypedLen(t)) 2002 } 2003 2004 switch t { 2005 case Int: 2006 at := a.Ints() 2007 bt := b.Ints() 2008 it := incr.Ints() 2009 2010 switch { 2011 case as && bs: 2012 VecDivI(at, bt) 2013 if !is { 2014 return e.Add(t, incr, a) 2015 } 2016 it[0] += at[0] 2017 case as && !bs: 2018 DivIncrSVI(at[0], bt, it) 2019 case !as && bs: 2020 DivIncrVSI(at, bt[0], it) 2021 default: 2022 DivIncrI(at, bt, it) 2023 } 2024 return 2025 case Int8: 2026 at := a.Int8s() 2027 bt := b.Int8s() 2028 it := incr.Int8s() 2029 2030 switch { 2031 case as && bs: 2032 VecDivI8(at, bt) 2033 if !is { 2034 return e.Add(t, incr, a) 2035 } 2036 it[0] += at[0] 2037 case as && !bs: 2038 DivIncrSVI8(at[0], bt, it) 2039 case !as && bs: 2040 DivIncrVSI8(at, bt[0], it) 2041 default: 2042 DivIncrI8(at, bt, it) 2043 } 2044 return 2045 case Int16: 2046 at := a.Int16s() 2047 bt := b.Int16s() 2048 it := incr.Int16s() 2049 2050 switch { 2051 case as && bs: 2052 VecDivI16(at, bt) 2053 if !is { 2054 return e.Add(t, incr, a) 2055 } 2056 it[0] += at[0] 2057 case as && !bs: 2058 DivIncrSVI16(at[0], bt, it) 2059 case !as && bs: 2060 DivIncrVSI16(at, bt[0], it) 2061 default: 2062 DivIncrI16(at, bt, it) 2063 } 2064 return 2065 case Int32: 2066 at := a.Int32s() 2067 bt := b.Int32s() 2068 it := incr.Int32s() 2069 2070 switch { 2071 case as && bs: 2072 VecDivI32(at, bt) 2073 if !is { 2074 return e.Add(t, incr, a) 2075 } 2076 it[0] += at[0] 2077 case as && !bs: 2078 DivIncrSVI32(at[0], bt, it) 2079 case !as && bs: 2080 DivIncrVSI32(at, bt[0], it) 2081 default: 2082 DivIncrI32(at, bt, it) 2083 } 2084 return 2085 case Int64: 2086 at := a.Int64s() 2087 bt := b.Int64s() 2088 it := incr.Int64s() 2089 2090 switch { 2091 case as && bs: 2092 VecDivI64(at, bt) 2093 if !is { 2094 return e.Add(t, incr, a) 2095 } 2096 it[0] += at[0] 2097 case as && !bs: 2098 DivIncrSVI64(at[0], bt, it) 2099 case !as && bs: 2100 DivIncrVSI64(at, bt[0], it) 2101 default: 2102 DivIncrI64(at, bt, it) 2103 } 2104 return 2105 case Uint: 2106 at := a.Uints() 2107 bt := b.Uints() 2108 it := incr.Uints() 2109 2110 switch { 2111 case as && bs: 2112 VecDivU(at, bt) 2113 if !is { 2114 return e.Add(t, incr, a) 2115 } 2116 it[0] += at[0] 2117 case as && !bs: 2118 DivIncrSVU(at[0], bt, it) 2119 case !as && bs: 2120 DivIncrVSU(at, bt[0], it) 2121 default: 2122 DivIncrU(at, bt, it) 2123 } 2124 return 2125 case Uint8: 2126 at := a.Uint8s() 2127 bt := b.Uint8s() 2128 it := incr.Uint8s() 2129 2130 switch { 2131 case as && bs: 2132 VecDivU8(at, bt) 2133 if !is { 2134 return e.Add(t, incr, a) 2135 } 2136 it[0] += at[0] 2137 case as && !bs: 2138 DivIncrSVU8(at[0], bt, it) 2139 case !as && bs: 2140 DivIncrVSU8(at, bt[0], it) 2141 default: 2142 DivIncrU8(at, bt, it) 2143 } 2144 return 2145 case Uint16: 2146 at := a.Uint16s() 2147 bt := b.Uint16s() 2148 it := incr.Uint16s() 2149 2150 switch { 2151 case as && bs: 2152 VecDivU16(at, bt) 2153 if !is { 2154 return e.Add(t, incr, a) 2155 } 2156 it[0] += at[0] 2157 case as && !bs: 2158 DivIncrSVU16(at[0], bt, it) 2159 case !as && bs: 2160 DivIncrVSU16(at, bt[0], it) 2161 default: 2162 DivIncrU16(at, bt, it) 2163 } 2164 return 2165 case Uint32: 2166 at := a.Uint32s() 2167 bt := b.Uint32s() 2168 it := incr.Uint32s() 2169 2170 switch { 2171 case as && bs: 2172 VecDivU32(at, bt) 2173 if !is { 2174 return e.Add(t, incr, a) 2175 } 2176 it[0] += at[0] 2177 case as && !bs: 2178 DivIncrSVU32(at[0], bt, it) 2179 case !as && bs: 2180 DivIncrVSU32(at, bt[0], it) 2181 default: 2182 DivIncrU32(at, bt, it) 2183 } 2184 return 2185 case Uint64: 2186 at := a.Uint64s() 2187 bt := b.Uint64s() 2188 it := incr.Uint64s() 2189 2190 switch { 2191 case as && bs: 2192 VecDivU64(at, bt) 2193 if !is { 2194 return e.Add(t, incr, a) 2195 } 2196 it[0] += at[0] 2197 case as && !bs: 2198 DivIncrSVU64(at[0], bt, it) 2199 case !as && bs: 2200 DivIncrVSU64(at, bt[0], it) 2201 default: 2202 DivIncrU64(at, bt, it) 2203 } 2204 return 2205 case Float32: 2206 at := a.Float32s() 2207 bt := b.Float32s() 2208 it := incr.Float32s() 2209 2210 switch { 2211 case as && bs: 2212 VecDivF32(at, bt) 2213 if !is { 2214 return e.Add(t, incr, a) 2215 } 2216 it[0] += at[0] 2217 case as && !bs: 2218 DivIncrSVF32(at[0], bt, it) 2219 case !as && bs: 2220 DivIncrVSF32(at, bt[0], it) 2221 default: 2222 DivIncrF32(at, bt, it) 2223 } 2224 return 2225 case Float64: 2226 at := a.Float64s() 2227 bt := b.Float64s() 2228 it := incr.Float64s() 2229 2230 switch { 2231 case as && bs: 2232 VecDivF64(at, bt) 2233 if !is { 2234 return e.Add(t, incr, a) 2235 } 2236 it[0] += at[0] 2237 case as && !bs: 2238 DivIncrSVF64(at[0], bt, it) 2239 case !as && bs: 2240 DivIncrVSF64(at, bt[0], it) 2241 default: 2242 DivIncrF64(at, bt, it) 2243 } 2244 return 2245 case Complex64: 2246 at := a.Complex64s() 2247 bt := b.Complex64s() 2248 it := incr.Complex64s() 2249 2250 switch { 2251 case as && bs: 2252 VecDivC64(at, bt) 2253 if !is { 2254 return e.Add(t, incr, a) 2255 } 2256 it[0] += at[0] 2257 case as && !bs: 2258 DivIncrSVC64(at[0], bt, it) 2259 case !as && bs: 2260 DivIncrVSC64(at, bt[0], it) 2261 default: 2262 DivIncrC64(at, bt, it) 2263 } 2264 return 2265 case Complex128: 2266 at := a.Complex128s() 2267 bt := b.Complex128s() 2268 it := incr.Complex128s() 2269 2270 switch { 2271 case as && bs: 2272 VecDivC128(at, bt) 2273 if !is { 2274 return e.Add(t, incr, a) 2275 } 2276 it[0] += at[0] 2277 case as && !bs: 2278 DivIncrSVC128(at[0], bt, it) 2279 case !as && bs: 2280 DivIncrVSC128(at, bt[0], it) 2281 default: 2282 DivIncrC128(at, bt, it) 2283 } 2284 return 2285 default: 2286 return errors.Errorf("Unsupported type %v for Div", t) 2287 } 2288 } 2289 2290 func (e E) PowIncr(t reflect.Type, a *storage.Header, b *storage.Header, incr *storage.Header) (err error) { 2291 as := isScalar(a, t) 2292 bs := isScalar(b, t) 2293 is := isScalar(incr, t) 2294 if ((as && !bs) || (bs && !as)) && is { 2295 return errors.Errorf("Cannot increment on scalar increment. a: %d, b %d", a.TypedLen(t), b.TypedLen(t)) 2296 } 2297 2298 switch t { 2299 case Float32: 2300 at := a.Float32s() 2301 bt := b.Float32s() 2302 it := incr.Float32s() 2303 2304 switch { 2305 case as && bs: 2306 VecPowF32(at, bt) 2307 if !is { 2308 return e.Add(t, incr, a) 2309 } 2310 it[0] += at[0] 2311 case as && !bs: 2312 PowIncrSVF32(at[0], bt, it) 2313 case !as && bs: 2314 PowIncrVSF32(at, bt[0], it) 2315 default: 2316 PowIncrF32(at, bt, it) 2317 } 2318 return 2319 case Float64: 2320 at := a.Float64s() 2321 bt := b.Float64s() 2322 it := incr.Float64s() 2323 2324 switch { 2325 case as && bs: 2326 VecPowF64(at, bt) 2327 if !is { 2328 return e.Add(t, incr, a) 2329 } 2330 it[0] += at[0] 2331 case as && !bs: 2332 PowIncrSVF64(at[0], bt, it) 2333 case !as && bs: 2334 PowIncrVSF64(at, bt[0], it) 2335 default: 2336 PowIncrF64(at, bt, it) 2337 } 2338 return 2339 case Complex64: 2340 at := a.Complex64s() 2341 bt := b.Complex64s() 2342 it := incr.Complex64s() 2343 2344 switch { 2345 case as && bs: 2346 VecPowC64(at, bt) 2347 if !is { 2348 return e.Add(t, incr, a) 2349 } 2350 it[0] += at[0] 2351 case as && !bs: 2352 PowIncrSVC64(at[0], bt, it) 2353 case !as && bs: 2354 PowIncrVSC64(at, bt[0], it) 2355 default: 2356 PowIncrC64(at, bt, it) 2357 } 2358 return 2359 case Complex128: 2360 at := a.Complex128s() 2361 bt := b.Complex128s() 2362 it := incr.Complex128s() 2363 2364 switch { 2365 case as && bs: 2366 VecPowC128(at, bt) 2367 if !is { 2368 return e.Add(t, incr, a) 2369 } 2370 it[0] += at[0] 2371 case as && !bs: 2372 PowIncrSVC128(at[0], bt, it) 2373 case !as && bs: 2374 PowIncrVSC128(at, bt[0], it) 2375 default: 2376 PowIncrC128(at, bt, it) 2377 } 2378 return 2379 default: 2380 return errors.Errorf("Unsupported type %v for Pow", t) 2381 } 2382 } 2383 2384 func (e E) ModIncr(t reflect.Type, a *storage.Header, b *storage.Header, incr *storage.Header) (err error) { 2385 as := isScalar(a, t) 2386 bs := isScalar(b, t) 2387 is := isScalar(incr, t) 2388 if ((as && !bs) || (bs && !as)) && is { 2389 return errors.Errorf("Cannot increment on scalar increment. a: %d, b %d", a.TypedLen(t), b.TypedLen(t)) 2390 } 2391 2392 switch t { 2393 case Int: 2394 at := a.Ints() 2395 bt := b.Ints() 2396 it := incr.Ints() 2397 2398 switch { 2399 case as && bs: 2400 VecModI(at, bt) 2401 if !is { 2402 return e.Add(t, incr, a) 2403 } 2404 it[0] += at[0] 2405 case as && !bs: 2406 ModIncrSVI(at[0], bt, it) 2407 case !as && bs: 2408 ModIncrVSI(at, bt[0], it) 2409 default: 2410 ModIncrI(at, bt, it) 2411 } 2412 return 2413 case Int8: 2414 at := a.Int8s() 2415 bt := b.Int8s() 2416 it := incr.Int8s() 2417 2418 switch { 2419 case as && bs: 2420 VecModI8(at, bt) 2421 if !is { 2422 return e.Add(t, incr, a) 2423 } 2424 it[0] += at[0] 2425 case as && !bs: 2426 ModIncrSVI8(at[0], bt, it) 2427 case !as && bs: 2428 ModIncrVSI8(at, bt[0], it) 2429 default: 2430 ModIncrI8(at, bt, it) 2431 } 2432 return 2433 case Int16: 2434 at := a.Int16s() 2435 bt := b.Int16s() 2436 it := incr.Int16s() 2437 2438 switch { 2439 case as && bs: 2440 VecModI16(at, bt) 2441 if !is { 2442 return e.Add(t, incr, a) 2443 } 2444 it[0] += at[0] 2445 case as && !bs: 2446 ModIncrSVI16(at[0], bt, it) 2447 case !as && bs: 2448 ModIncrVSI16(at, bt[0], it) 2449 default: 2450 ModIncrI16(at, bt, it) 2451 } 2452 return 2453 case Int32: 2454 at := a.Int32s() 2455 bt := b.Int32s() 2456 it := incr.Int32s() 2457 2458 switch { 2459 case as && bs: 2460 VecModI32(at, bt) 2461 if !is { 2462 return e.Add(t, incr, a) 2463 } 2464 it[0] += at[0] 2465 case as && !bs: 2466 ModIncrSVI32(at[0], bt, it) 2467 case !as && bs: 2468 ModIncrVSI32(at, bt[0], it) 2469 default: 2470 ModIncrI32(at, bt, it) 2471 } 2472 return 2473 case Int64: 2474 at := a.Int64s() 2475 bt := b.Int64s() 2476 it := incr.Int64s() 2477 2478 switch { 2479 case as && bs: 2480 VecModI64(at, bt) 2481 if !is { 2482 return e.Add(t, incr, a) 2483 } 2484 it[0] += at[0] 2485 case as && !bs: 2486 ModIncrSVI64(at[0], bt, it) 2487 case !as && bs: 2488 ModIncrVSI64(at, bt[0], it) 2489 default: 2490 ModIncrI64(at, bt, it) 2491 } 2492 return 2493 case Uint: 2494 at := a.Uints() 2495 bt := b.Uints() 2496 it := incr.Uints() 2497 2498 switch { 2499 case as && bs: 2500 VecModU(at, bt) 2501 if !is { 2502 return e.Add(t, incr, a) 2503 } 2504 it[0] += at[0] 2505 case as && !bs: 2506 ModIncrSVU(at[0], bt, it) 2507 case !as && bs: 2508 ModIncrVSU(at, bt[0], it) 2509 default: 2510 ModIncrU(at, bt, it) 2511 } 2512 return 2513 case Uint8: 2514 at := a.Uint8s() 2515 bt := b.Uint8s() 2516 it := incr.Uint8s() 2517 2518 switch { 2519 case as && bs: 2520 VecModU8(at, bt) 2521 if !is { 2522 return e.Add(t, incr, a) 2523 } 2524 it[0] += at[0] 2525 case as && !bs: 2526 ModIncrSVU8(at[0], bt, it) 2527 case !as && bs: 2528 ModIncrVSU8(at, bt[0], it) 2529 default: 2530 ModIncrU8(at, bt, it) 2531 } 2532 return 2533 case Uint16: 2534 at := a.Uint16s() 2535 bt := b.Uint16s() 2536 it := incr.Uint16s() 2537 2538 switch { 2539 case as && bs: 2540 VecModU16(at, bt) 2541 if !is { 2542 return e.Add(t, incr, a) 2543 } 2544 it[0] += at[0] 2545 case as && !bs: 2546 ModIncrSVU16(at[0], bt, it) 2547 case !as && bs: 2548 ModIncrVSU16(at, bt[0], it) 2549 default: 2550 ModIncrU16(at, bt, it) 2551 } 2552 return 2553 case Uint32: 2554 at := a.Uint32s() 2555 bt := b.Uint32s() 2556 it := incr.Uint32s() 2557 2558 switch { 2559 case as && bs: 2560 VecModU32(at, bt) 2561 if !is { 2562 return e.Add(t, incr, a) 2563 } 2564 it[0] += at[0] 2565 case as && !bs: 2566 ModIncrSVU32(at[0], bt, it) 2567 case !as && bs: 2568 ModIncrVSU32(at, bt[0], it) 2569 default: 2570 ModIncrU32(at, bt, it) 2571 } 2572 return 2573 case Uint64: 2574 at := a.Uint64s() 2575 bt := b.Uint64s() 2576 it := incr.Uint64s() 2577 2578 switch { 2579 case as && bs: 2580 VecModU64(at, bt) 2581 if !is { 2582 return e.Add(t, incr, a) 2583 } 2584 it[0] += at[0] 2585 case as && !bs: 2586 ModIncrSVU64(at[0], bt, it) 2587 case !as && bs: 2588 ModIncrVSU64(at, bt[0], it) 2589 default: 2590 ModIncrU64(at, bt, it) 2591 } 2592 return 2593 case Float32: 2594 at := a.Float32s() 2595 bt := b.Float32s() 2596 it := incr.Float32s() 2597 2598 switch { 2599 case as && bs: 2600 VecModF32(at, bt) 2601 if !is { 2602 return e.Add(t, incr, a) 2603 } 2604 it[0] += at[0] 2605 case as && !bs: 2606 ModIncrSVF32(at[0], bt, it) 2607 case !as && bs: 2608 ModIncrVSF32(at, bt[0], it) 2609 default: 2610 ModIncrF32(at, bt, it) 2611 } 2612 return 2613 case Float64: 2614 at := a.Float64s() 2615 bt := b.Float64s() 2616 it := incr.Float64s() 2617 2618 switch { 2619 case as && bs: 2620 VecModF64(at, bt) 2621 if !is { 2622 return e.Add(t, incr, a) 2623 } 2624 it[0] += at[0] 2625 case as && !bs: 2626 ModIncrSVF64(at[0], bt, it) 2627 case !as && bs: 2628 ModIncrVSF64(at, bt[0], it) 2629 default: 2630 ModIncrF64(at, bt, it) 2631 } 2632 return 2633 default: 2634 return errors.Errorf("Unsupported type %v for Mod", t) 2635 } 2636 } 2637 2638 func (e E) AddIter(t reflect.Type, a *storage.Header, b *storage.Header, ait Iterator, bit Iterator) (err error) { 2639 as := isScalar(a, t) 2640 bs := isScalar(b, t) 2641 2642 switch t { 2643 case Int: 2644 at := a.Ints() 2645 bt := b.Ints() 2646 switch { 2647 case as && bs: 2648 VecAddI(at, bt) 2649 case as && !bs: 2650 AddIterSVI(at[0], bt, bit) 2651 case !as && bs: 2652 AddIterVSI(at, bt[0], ait) 2653 default: 2654 AddIterI(at, bt, ait, bit) 2655 } 2656 return 2657 case Int8: 2658 at := a.Int8s() 2659 bt := b.Int8s() 2660 switch { 2661 case as && bs: 2662 VecAddI8(at, bt) 2663 case as && !bs: 2664 AddIterSVI8(at[0], bt, bit) 2665 case !as && bs: 2666 AddIterVSI8(at, bt[0], ait) 2667 default: 2668 AddIterI8(at, bt, ait, bit) 2669 } 2670 return 2671 case Int16: 2672 at := a.Int16s() 2673 bt := b.Int16s() 2674 switch { 2675 case as && bs: 2676 VecAddI16(at, bt) 2677 case as && !bs: 2678 AddIterSVI16(at[0], bt, bit) 2679 case !as && bs: 2680 AddIterVSI16(at, bt[0], ait) 2681 default: 2682 AddIterI16(at, bt, ait, bit) 2683 } 2684 return 2685 case Int32: 2686 at := a.Int32s() 2687 bt := b.Int32s() 2688 switch { 2689 case as && bs: 2690 VecAddI32(at, bt) 2691 case as && !bs: 2692 AddIterSVI32(at[0], bt, bit) 2693 case !as && bs: 2694 AddIterVSI32(at, bt[0], ait) 2695 default: 2696 AddIterI32(at, bt, ait, bit) 2697 } 2698 return 2699 case Int64: 2700 at := a.Int64s() 2701 bt := b.Int64s() 2702 switch { 2703 case as && bs: 2704 VecAddI64(at, bt) 2705 case as && !bs: 2706 AddIterSVI64(at[0], bt, bit) 2707 case !as && bs: 2708 AddIterVSI64(at, bt[0], ait) 2709 default: 2710 AddIterI64(at, bt, ait, bit) 2711 } 2712 return 2713 case Uint: 2714 at := a.Uints() 2715 bt := b.Uints() 2716 switch { 2717 case as && bs: 2718 VecAddU(at, bt) 2719 case as && !bs: 2720 AddIterSVU(at[0], bt, bit) 2721 case !as && bs: 2722 AddIterVSU(at, bt[0], ait) 2723 default: 2724 AddIterU(at, bt, ait, bit) 2725 } 2726 return 2727 case Uint8: 2728 at := a.Uint8s() 2729 bt := b.Uint8s() 2730 switch { 2731 case as && bs: 2732 VecAddU8(at, bt) 2733 case as && !bs: 2734 AddIterSVU8(at[0], bt, bit) 2735 case !as && bs: 2736 AddIterVSU8(at, bt[0], ait) 2737 default: 2738 AddIterU8(at, bt, ait, bit) 2739 } 2740 return 2741 case Uint16: 2742 at := a.Uint16s() 2743 bt := b.Uint16s() 2744 switch { 2745 case as && bs: 2746 VecAddU16(at, bt) 2747 case as && !bs: 2748 AddIterSVU16(at[0], bt, bit) 2749 case !as && bs: 2750 AddIterVSU16(at, bt[0], ait) 2751 default: 2752 AddIterU16(at, bt, ait, bit) 2753 } 2754 return 2755 case Uint32: 2756 at := a.Uint32s() 2757 bt := b.Uint32s() 2758 switch { 2759 case as && bs: 2760 VecAddU32(at, bt) 2761 case as && !bs: 2762 AddIterSVU32(at[0], bt, bit) 2763 case !as && bs: 2764 AddIterVSU32(at, bt[0], ait) 2765 default: 2766 AddIterU32(at, bt, ait, bit) 2767 } 2768 return 2769 case Uint64: 2770 at := a.Uint64s() 2771 bt := b.Uint64s() 2772 switch { 2773 case as && bs: 2774 VecAddU64(at, bt) 2775 case as && !bs: 2776 AddIterSVU64(at[0], bt, bit) 2777 case !as && bs: 2778 AddIterVSU64(at, bt[0], ait) 2779 default: 2780 AddIterU64(at, bt, ait, bit) 2781 } 2782 return 2783 case Float32: 2784 at := a.Float32s() 2785 bt := b.Float32s() 2786 switch { 2787 case as && bs: 2788 VecAddF32(at, bt) 2789 case as && !bs: 2790 AddIterSVF32(at[0], bt, bit) 2791 case !as && bs: 2792 AddIterVSF32(at, bt[0], ait) 2793 default: 2794 AddIterF32(at, bt, ait, bit) 2795 } 2796 return 2797 case Float64: 2798 at := a.Float64s() 2799 bt := b.Float64s() 2800 switch { 2801 case as && bs: 2802 VecAddF64(at, bt) 2803 case as && !bs: 2804 AddIterSVF64(at[0], bt, bit) 2805 case !as && bs: 2806 AddIterVSF64(at, bt[0], ait) 2807 default: 2808 AddIterF64(at, bt, ait, bit) 2809 } 2810 return 2811 case Complex64: 2812 at := a.Complex64s() 2813 bt := b.Complex64s() 2814 switch { 2815 case as && bs: 2816 VecAddC64(at, bt) 2817 case as && !bs: 2818 AddIterSVC64(at[0], bt, bit) 2819 case !as && bs: 2820 AddIterVSC64(at, bt[0], ait) 2821 default: 2822 AddIterC64(at, bt, ait, bit) 2823 } 2824 return 2825 case Complex128: 2826 at := a.Complex128s() 2827 bt := b.Complex128s() 2828 switch { 2829 case as && bs: 2830 VecAddC128(at, bt) 2831 case as && !bs: 2832 AddIterSVC128(at[0], bt, bit) 2833 case !as && bs: 2834 AddIterVSC128(at, bt[0], ait) 2835 default: 2836 AddIterC128(at, bt, ait, bit) 2837 } 2838 return 2839 case String: 2840 at := a.Strings() 2841 bt := b.Strings() 2842 switch { 2843 case as && bs: 2844 VecAddStr(at, bt) 2845 case as && !bs: 2846 AddIterSVStr(at[0], bt, bit) 2847 case !as && bs: 2848 AddIterVSStr(at, bt[0], ait) 2849 default: 2850 AddIterStr(at, bt, ait, bit) 2851 } 2852 return 2853 default: 2854 return errors.Errorf("Unsupported type %v for AddIter", t) 2855 } 2856 } 2857 2858 func (e E) SubIter(t reflect.Type, a *storage.Header, b *storage.Header, ait Iterator, bit Iterator) (err error) { 2859 as := isScalar(a, t) 2860 bs := isScalar(b, t) 2861 2862 switch t { 2863 case Int: 2864 at := a.Ints() 2865 bt := b.Ints() 2866 switch { 2867 case as && bs: 2868 VecSubI(at, bt) 2869 case as && !bs: 2870 SubIterSVI(at[0], bt, bit) 2871 case !as && bs: 2872 SubIterVSI(at, bt[0], ait) 2873 default: 2874 SubIterI(at, bt, ait, bit) 2875 } 2876 return 2877 case Int8: 2878 at := a.Int8s() 2879 bt := b.Int8s() 2880 switch { 2881 case as && bs: 2882 VecSubI8(at, bt) 2883 case as && !bs: 2884 SubIterSVI8(at[0], bt, bit) 2885 case !as && bs: 2886 SubIterVSI8(at, bt[0], ait) 2887 default: 2888 SubIterI8(at, bt, ait, bit) 2889 } 2890 return 2891 case Int16: 2892 at := a.Int16s() 2893 bt := b.Int16s() 2894 switch { 2895 case as && bs: 2896 VecSubI16(at, bt) 2897 case as && !bs: 2898 SubIterSVI16(at[0], bt, bit) 2899 case !as && bs: 2900 SubIterVSI16(at, bt[0], ait) 2901 default: 2902 SubIterI16(at, bt, ait, bit) 2903 } 2904 return 2905 case Int32: 2906 at := a.Int32s() 2907 bt := b.Int32s() 2908 switch { 2909 case as && bs: 2910 VecSubI32(at, bt) 2911 case as && !bs: 2912 SubIterSVI32(at[0], bt, bit) 2913 case !as && bs: 2914 SubIterVSI32(at, bt[0], ait) 2915 default: 2916 SubIterI32(at, bt, ait, bit) 2917 } 2918 return 2919 case Int64: 2920 at := a.Int64s() 2921 bt := b.Int64s() 2922 switch { 2923 case as && bs: 2924 VecSubI64(at, bt) 2925 case as && !bs: 2926 SubIterSVI64(at[0], bt, bit) 2927 case !as && bs: 2928 SubIterVSI64(at, bt[0], ait) 2929 default: 2930 SubIterI64(at, bt, ait, bit) 2931 } 2932 return 2933 case Uint: 2934 at := a.Uints() 2935 bt := b.Uints() 2936 switch { 2937 case as && bs: 2938 VecSubU(at, bt) 2939 case as && !bs: 2940 SubIterSVU(at[0], bt, bit) 2941 case !as && bs: 2942 SubIterVSU(at, bt[0], ait) 2943 default: 2944 SubIterU(at, bt, ait, bit) 2945 } 2946 return 2947 case Uint8: 2948 at := a.Uint8s() 2949 bt := b.Uint8s() 2950 switch { 2951 case as && bs: 2952 VecSubU8(at, bt) 2953 case as && !bs: 2954 SubIterSVU8(at[0], bt, bit) 2955 case !as && bs: 2956 SubIterVSU8(at, bt[0], ait) 2957 default: 2958 SubIterU8(at, bt, ait, bit) 2959 } 2960 return 2961 case Uint16: 2962 at := a.Uint16s() 2963 bt := b.Uint16s() 2964 switch { 2965 case as && bs: 2966 VecSubU16(at, bt) 2967 case as && !bs: 2968 SubIterSVU16(at[0], bt, bit) 2969 case !as && bs: 2970 SubIterVSU16(at, bt[0], ait) 2971 default: 2972 SubIterU16(at, bt, ait, bit) 2973 } 2974 return 2975 case Uint32: 2976 at := a.Uint32s() 2977 bt := b.Uint32s() 2978 switch { 2979 case as && bs: 2980 VecSubU32(at, bt) 2981 case as && !bs: 2982 SubIterSVU32(at[0], bt, bit) 2983 case !as && bs: 2984 SubIterVSU32(at, bt[0], ait) 2985 default: 2986 SubIterU32(at, bt, ait, bit) 2987 } 2988 return 2989 case Uint64: 2990 at := a.Uint64s() 2991 bt := b.Uint64s() 2992 switch { 2993 case as && bs: 2994 VecSubU64(at, bt) 2995 case as && !bs: 2996 SubIterSVU64(at[0], bt, bit) 2997 case !as && bs: 2998 SubIterVSU64(at, bt[0], ait) 2999 default: 3000 SubIterU64(at, bt, ait, bit) 3001 } 3002 return 3003 case Float32: 3004 at := a.Float32s() 3005 bt := b.Float32s() 3006 switch { 3007 case as && bs: 3008 VecSubF32(at, bt) 3009 case as && !bs: 3010 SubIterSVF32(at[0], bt, bit) 3011 case !as && bs: 3012 SubIterVSF32(at, bt[0], ait) 3013 default: 3014 SubIterF32(at, bt, ait, bit) 3015 } 3016 return 3017 case Float64: 3018 at := a.Float64s() 3019 bt := b.Float64s() 3020 switch { 3021 case as && bs: 3022 VecSubF64(at, bt) 3023 case as && !bs: 3024 SubIterSVF64(at[0], bt, bit) 3025 case !as && bs: 3026 SubIterVSF64(at, bt[0], ait) 3027 default: 3028 SubIterF64(at, bt, ait, bit) 3029 } 3030 return 3031 case Complex64: 3032 at := a.Complex64s() 3033 bt := b.Complex64s() 3034 switch { 3035 case as && bs: 3036 VecSubC64(at, bt) 3037 case as && !bs: 3038 SubIterSVC64(at[0], bt, bit) 3039 case !as && bs: 3040 SubIterVSC64(at, bt[0], ait) 3041 default: 3042 SubIterC64(at, bt, ait, bit) 3043 } 3044 return 3045 case Complex128: 3046 at := a.Complex128s() 3047 bt := b.Complex128s() 3048 switch { 3049 case as && bs: 3050 VecSubC128(at, bt) 3051 case as && !bs: 3052 SubIterSVC128(at[0], bt, bit) 3053 case !as && bs: 3054 SubIterVSC128(at, bt[0], ait) 3055 default: 3056 SubIterC128(at, bt, ait, bit) 3057 } 3058 return 3059 default: 3060 return errors.Errorf("Unsupported type %v for SubIter", t) 3061 } 3062 } 3063 3064 func (e E) MulIter(t reflect.Type, a *storage.Header, b *storage.Header, ait Iterator, bit Iterator) (err error) { 3065 as := isScalar(a, t) 3066 bs := isScalar(b, t) 3067 3068 switch t { 3069 case Int: 3070 at := a.Ints() 3071 bt := b.Ints() 3072 switch { 3073 case as && bs: 3074 VecMulI(at, bt) 3075 case as && !bs: 3076 MulIterSVI(at[0], bt, bit) 3077 case !as && bs: 3078 MulIterVSI(at, bt[0], ait) 3079 default: 3080 MulIterI(at, bt, ait, bit) 3081 } 3082 return 3083 case Int8: 3084 at := a.Int8s() 3085 bt := b.Int8s() 3086 switch { 3087 case as && bs: 3088 VecMulI8(at, bt) 3089 case as && !bs: 3090 MulIterSVI8(at[0], bt, bit) 3091 case !as && bs: 3092 MulIterVSI8(at, bt[0], ait) 3093 default: 3094 MulIterI8(at, bt, ait, bit) 3095 } 3096 return 3097 case Int16: 3098 at := a.Int16s() 3099 bt := b.Int16s() 3100 switch { 3101 case as && bs: 3102 VecMulI16(at, bt) 3103 case as && !bs: 3104 MulIterSVI16(at[0], bt, bit) 3105 case !as && bs: 3106 MulIterVSI16(at, bt[0], ait) 3107 default: 3108 MulIterI16(at, bt, ait, bit) 3109 } 3110 return 3111 case Int32: 3112 at := a.Int32s() 3113 bt := b.Int32s() 3114 switch { 3115 case as && bs: 3116 VecMulI32(at, bt) 3117 case as && !bs: 3118 MulIterSVI32(at[0], bt, bit) 3119 case !as && bs: 3120 MulIterVSI32(at, bt[0], ait) 3121 default: 3122 MulIterI32(at, bt, ait, bit) 3123 } 3124 return 3125 case Int64: 3126 at := a.Int64s() 3127 bt := b.Int64s() 3128 switch { 3129 case as && bs: 3130 VecMulI64(at, bt) 3131 case as && !bs: 3132 MulIterSVI64(at[0], bt, bit) 3133 case !as && bs: 3134 MulIterVSI64(at, bt[0], ait) 3135 default: 3136 MulIterI64(at, bt, ait, bit) 3137 } 3138 return 3139 case Uint: 3140 at := a.Uints() 3141 bt := b.Uints() 3142 switch { 3143 case as && bs: 3144 VecMulU(at, bt) 3145 case as && !bs: 3146 MulIterSVU(at[0], bt, bit) 3147 case !as && bs: 3148 MulIterVSU(at, bt[0], ait) 3149 default: 3150 MulIterU(at, bt, ait, bit) 3151 } 3152 return 3153 case Uint8: 3154 at := a.Uint8s() 3155 bt := b.Uint8s() 3156 switch { 3157 case as && bs: 3158 VecMulU8(at, bt) 3159 case as && !bs: 3160 MulIterSVU8(at[0], bt, bit) 3161 case !as && bs: 3162 MulIterVSU8(at, bt[0], ait) 3163 default: 3164 MulIterU8(at, bt, ait, bit) 3165 } 3166 return 3167 case Uint16: 3168 at := a.Uint16s() 3169 bt := b.Uint16s() 3170 switch { 3171 case as && bs: 3172 VecMulU16(at, bt) 3173 case as && !bs: 3174 MulIterSVU16(at[0], bt, bit) 3175 case !as && bs: 3176 MulIterVSU16(at, bt[0], ait) 3177 default: 3178 MulIterU16(at, bt, ait, bit) 3179 } 3180 return 3181 case Uint32: 3182 at := a.Uint32s() 3183 bt := b.Uint32s() 3184 switch { 3185 case as && bs: 3186 VecMulU32(at, bt) 3187 case as && !bs: 3188 MulIterSVU32(at[0], bt, bit) 3189 case !as && bs: 3190 MulIterVSU32(at, bt[0], ait) 3191 default: 3192 MulIterU32(at, bt, ait, bit) 3193 } 3194 return 3195 case Uint64: 3196 at := a.Uint64s() 3197 bt := b.Uint64s() 3198 switch { 3199 case as && bs: 3200 VecMulU64(at, bt) 3201 case as && !bs: 3202 MulIterSVU64(at[0], bt, bit) 3203 case !as && bs: 3204 MulIterVSU64(at, bt[0], ait) 3205 default: 3206 MulIterU64(at, bt, ait, bit) 3207 } 3208 return 3209 case Float32: 3210 at := a.Float32s() 3211 bt := b.Float32s() 3212 switch { 3213 case as && bs: 3214 VecMulF32(at, bt) 3215 case as && !bs: 3216 MulIterSVF32(at[0], bt, bit) 3217 case !as && bs: 3218 MulIterVSF32(at, bt[0], ait) 3219 default: 3220 MulIterF32(at, bt, ait, bit) 3221 } 3222 return 3223 case Float64: 3224 at := a.Float64s() 3225 bt := b.Float64s() 3226 switch { 3227 case as && bs: 3228 VecMulF64(at, bt) 3229 case as && !bs: 3230 MulIterSVF64(at[0], bt, bit) 3231 case !as && bs: 3232 MulIterVSF64(at, bt[0], ait) 3233 default: 3234 MulIterF64(at, bt, ait, bit) 3235 } 3236 return 3237 case Complex64: 3238 at := a.Complex64s() 3239 bt := b.Complex64s() 3240 switch { 3241 case as && bs: 3242 VecMulC64(at, bt) 3243 case as && !bs: 3244 MulIterSVC64(at[0], bt, bit) 3245 case !as && bs: 3246 MulIterVSC64(at, bt[0], ait) 3247 default: 3248 MulIterC64(at, bt, ait, bit) 3249 } 3250 return 3251 case Complex128: 3252 at := a.Complex128s() 3253 bt := b.Complex128s() 3254 switch { 3255 case as && bs: 3256 VecMulC128(at, bt) 3257 case as && !bs: 3258 MulIterSVC128(at[0], bt, bit) 3259 case !as && bs: 3260 MulIterVSC128(at, bt[0], ait) 3261 default: 3262 MulIterC128(at, bt, ait, bit) 3263 } 3264 return 3265 default: 3266 return errors.Errorf("Unsupported type %v for MulIter", t) 3267 } 3268 } 3269 3270 func (e E) DivIter(t reflect.Type, a *storage.Header, b *storage.Header, ait Iterator, bit Iterator) (err error) { 3271 as := isScalar(a, t) 3272 bs := isScalar(b, t) 3273 3274 switch t { 3275 case Int: 3276 at := a.Ints() 3277 bt := b.Ints() 3278 switch { 3279 case as && bs: 3280 VecDivI(at, bt) 3281 case as && !bs: 3282 DivIterSVI(at[0], bt, bit) 3283 case !as && bs: 3284 DivIterVSI(at, bt[0], ait) 3285 default: 3286 DivIterI(at, bt, ait, bit) 3287 } 3288 return 3289 case Int8: 3290 at := a.Int8s() 3291 bt := b.Int8s() 3292 switch { 3293 case as && bs: 3294 VecDivI8(at, bt) 3295 case as && !bs: 3296 DivIterSVI8(at[0], bt, bit) 3297 case !as && bs: 3298 DivIterVSI8(at, bt[0], ait) 3299 default: 3300 DivIterI8(at, bt, ait, bit) 3301 } 3302 return 3303 case Int16: 3304 at := a.Int16s() 3305 bt := b.Int16s() 3306 switch { 3307 case as && bs: 3308 VecDivI16(at, bt) 3309 case as && !bs: 3310 DivIterSVI16(at[0], bt, bit) 3311 case !as && bs: 3312 DivIterVSI16(at, bt[0], ait) 3313 default: 3314 DivIterI16(at, bt, ait, bit) 3315 } 3316 return 3317 case Int32: 3318 at := a.Int32s() 3319 bt := b.Int32s() 3320 switch { 3321 case as && bs: 3322 VecDivI32(at, bt) 3323 case as && !bs: 3324 DivIterSVI32(at[0], bt, bit) 3325 case !as && bs: 3326 DivIterVSI32(at, bt[0], ait) 3327 default: 3328 DivIterI32(at, bt, ait, bit) 3329 } 3330 return 3331 case Int64: 3332 at := a.Int64s() 3333 bt := b.Int64s() 3334 switch { 3335 case as && bs: 3336 VecDivI64(at, bt) 3337 case as && !bs: 3338 DivIterSVI64(at[0], bt, bit) 3339 case !as && bs: 3340 DivIterVSI64(at, bt[0], ait) 3341 default: 3342 DivIterI64(at, bt, ait, bit) 3343 } 3344 return 3345 case Uint: 3346 at := a.Uints() 3347 bt := b.Uints() 3348 switch { 3349 case as && bs: 3350 VecDivU(at, bt) 3351 case as && !bs: 3352 DivIterSVU(at[0], bt, bit) 3353 case !as && bs: 3354 DivIterVSU(at, bt[0], ait) 3355 default: 3356 DivIterU(at, bt, ait, bit) 3357 } 3358 return 3359 case Uint8: 3360 at := a.Uint8s() 3361 bt := b.Uint8s() 3362 switch { 3363 case as && bs: 3364 VecDivU8(at, bt) 3365 case as && !bs: 3366 DivIterSVU8(at[0], bt, bit) 3367 case !as && bs: 3368 DivIterVSU8(at, bt[0], ait) 3369 default: 3370 DivIterU8(at, bt, ait, bit) 3371 } 3372 return 3373 case Uint16: 3374 at := a.Uint16s() 3375 bt := b.Uint16s() 3376 switch { 3377 case as && bs: 3378 VecDivU16(at, bt) 3379 case as && !bs: 3380 DivIterSVU16(at[0], bt, bit) 3381 case !as && bs: 3382 DivIterVSU16(at, bt[0], ait) 3383 default: 3384 DivIterU16(at, bt, ait, bit) 3385 } 3386 return 3387 case Uint32: 3388 at := a.Uint32s() 3389 bt := b.Uint32s() 3390 switch { 3391 case as && bs: 3392 VecDivU32(at, bt) 3393 case as && !bs: 3394 DivIterSVU32(at[0], bt, bit) 3395 case !as && bs: 3396 DivIterVSU32(at, bt[0], ait) 3397 default: 3398 DivIterU32(at, bt, ait, bit) 3399 } 3400 return 3401 case Uint64: 3402 at := a.Uint64s() 3403 bt := b.Uint64s() 3404 switch { 3405 case as && bs: 3406 VecDivU64(at, bt) 3407 case as && !bs: 3408 DivIterSVU64(at[0], bt, bit) 3409 case !as && bs: 3410 DivIterVSU64(at, bt[0], ait) 3411 default: 3412 DivIterU64(at, bt, ait, bit) 3413 } 3414 return 3415 case Float32: 3416 at := a.Float32s() 3417 bt := b.Float32s() 3418 switch { 3419 case as && bs: 3420 VecDivF32(at, bt) 3421 case as && !bs: 3422 DivIterSVF32(at[0], bt, bit) 3423 case !as && bs: 3424 DivIterVSF32(at, bt[0], ait) 3425 default: 3426 DivIterF32(at, bt, ait, bit) 3427 } 3428 return 3429 case Float64: 3430 at := a.Float64s() 3431 bt := b.Float64s() 3432 switch { 3433 case as && bs: 3434 VecDivF64(at, bt) 3435 case as && !bs: 3436 DivIterSVF64(at[0], bt, bit) 3437 case !as && bs: 3438 DivIterVSF64(at, bt[0], ait) 3439 default: 3440 DivIterF64(at, bt, ait, bit) 3441 } 3442 return 3443 case Complex64: 3444 at := a.Complex64s() 3445 bt := b.Complex64s() 3446 switch { 3447 case as && bs: 3448 VecDivC64(at, bt) 3449 case as && !bs: 3450 DivIterSVC64(at[0], bt, bit) 3451 case !as && bs: 3452 DivIterVSC64(at, bt[0], ait) 3453 default: 3454 DivIterC64(at, bt, ait, bit) 3455 } 3456 return 3457 case Complex128: 3458 at := a.Complex128s() 3459 bt := b.Complex128s() 3460 switch { 3461 case as && bs: 3462 VecDivC128(at, bt) 3463 case as && !bs: 3464 DivIterSVC128(at[0], bt, bit) 3465 case !as && bs: 3466 DivIterVSC128(at, bt[0], ait) 3467 default: 3468 DivIterC128(at, bt, ait, bit) 3469 } 3470 return 3471 default: 3472 return errors.Errorf("Unsupported type %v for DivIter", t) 3473 } 3474 } 3475 3476 func (e E) PowIter(t reflect.Type, a *storage.Header, b *storage.Header, ait Iterator, bit Iterator) (err error) { 3477 as := isScalar(a, t) 3478 bs := isScalar(b, t) 3479 3480 switch t { 3481 case Float32: 3482 at := a.Float32s() 3483 bt := b.Float32s() 3484 switch { 3485 case as && bs: 3486 VecPowF32(at, bt) 3487 case as && !bs: 3488 PowIterSVF32(at[0], bt, bit) 3489 case !as && bs: 3490 PowIterVSF32(at, bt[0], ait) 3491 default: 3492 PowIterF32(at, bt, ait, bit) 3493 } 3494 return 3495 case Float64: 3496 at := a.Float64s() 3497 bt := b.Float64s() 3498 switch { 3499 case as && bs: 3500 VecPowF64(at, bt) 3501 case as && !bs: 3502 PowIterSVF64(at[0], bt, bit) 3503 case !as && bs: 3504 PowIterVSF64(at, bt[0], ait) 3505 default: 3506 PowIterF64(at, bt, ait, bit) 3507 } 3508 return 3509 case Complex64: 3510 at := a.Complex64s() 3511 bt := b.Complex64s() 3512 switch { 3513 case as && bs: 3514 VecPowC64(at, bt) 3515 case as && !bs: 3516 PowIterSVC64(at[0], bt, bit) 3517 case !as && bs: 3518 PowIterVSC64(at, bt[0], ait) 3519 default: 3520 PowIterC64(at, bt, ait, bit) 3521 } 3522 return 3523 case Complex128: 3524 at := a.Complex128s() 3525 bt := b.Complex128s() 3526 switch { 3527 case as && bs: 3528 VecPowC128(at, bt) 3529 case as && !bs: 3530 PowIterSVC128(at[0], bt, bit) 3531 case !as && bs: 3532 PowIterVSC128(at, bt[0], ait) 3533 default: 3534 PowIterC128(at, bt, ait, bit) 3535 } 3536 return 3537 default: 3538 return errors.Errorf("Unsupported type %v for PowIter", t) 3539 } 3540 } 3541 3542 func (e E) ModIter(t reflect.Type, a *storage.Header, b *storage.Header, ait Iterator, bit Iterator) (err error) { 3543 as := isScalar(a, t) 3544 bs := isScalar(b, t) 3545 3546 switch t { 3547 case Int: 3548 at := a.Ints() 3549 bt := b.Ints() 3550 switch { 3551 case as && bs: 3552 VecModI(at, bt) 3553 case as && !bs: 3554 ModIterSVI(at[0], bt, bit) 3555 case !as && bs: 3556 ModIterVSI(at, bt[0], ait) 3557 default: 3558 ModIterI(at, bt, ait, bit) 3559 } 3560 return 3561 case Int8: 3562 at := a.Int8s() 3563 bt := b.Int8s() 3564 switch { 3565 case as && bs: 3566 VecModI8(at, bt) 3567 case as && !bs: 3568 ModIterSVI8(at[0], bt, bit) 3569 case !as && bs: 3570 ModIterVSI8(at, bt[0], ait) 3571 default: 3572 ModIterI8(at, bt, ait, bit) 3573 } 3574 return 3575 case Int16: 3576 at := a.Int16s() 3577 bt := b.Int16s() 3578 switch { 3579 case as && bs: 3580 VecModI16(at, bt) 3581 case as && !bs: 3582 ModIterSVI16(at[0], bt, bit) 3583 case !as && bs: 3584 ModIterVSI16(at, bt[0], ait) 3585 default: 3586 ModIterI16(at, bt, ait, bit) 3587 } 3588 return 3589 case Int32: 3590 at := a.Int32s() 3591 bt := b.Int32s() 3592 switch { 3593 case as && bs: 3594 VecModI32(at, bt) 3595 case as && !bs: 3596 ModIterSVI32(at[0], bt, bit) 3597 case !as && bs: 3598 ModIterVSI32(at, bt[0], ait) 3599 default: 3600 ModIterI32(at, bt, ait, bit) 3601 } 3602 return 3603 case Int64: 3604 at := a.Int64s() 3605 bt := b.Int64s() 3606 switch { 3607 case as && bs: 3608 VecModI64(at, bt) 3609 case as && !bs: 3610 ModIterSVI64(at[0], bt, bit) 3611 case !as && bs: 3612 ModIterVSI64(at, bt[0], ait) 3613 default: 3614 ModIterI64(at, bt, ait, bit) 3615 } 3616 return 3617 case Uint: 3618 at := a.Uints() 3619 bt := b.Uints() 3620 switch { 3621 case as && bs: 3622 VecModU(at, bt) 3623 case as && !bs: 3624 ModIterSVU(at[0], bt, bit) 3625 case !as && bs: 3626 ModIterVSU(at, bt[0], ait) 3627 default: 3628 ModIterU(at, bt, ait, bit) 3629 } 3630 return 3631 case Uint8: 3632 at := a.Uint8s() 3633 bt := b.Uint8s() 3634 switch { 3635 case as && bs: 3636 VecModU8(at, bt) 3637 case as && !bs: 3638 ModIterSVU8(at[0], bt, bit) 3639 case !as && bs: 3640 ModIterVSU8(at, bt[0], ait) 3641 default: 3642 ModIterU8(at, bt, ait, bit) 3643 } 3644 return 3645 case Uint16: 3646 at := a.Uint16s() 3647 bt := b.Uint16s() 3648 switch { 3649 case as && bs: 3650 VecModU16(at, bt) 3651 case as && !bs: 3652 ModIterSVU16(at[0], bt, bit) 3653 case !as && bs: 3654 ModIterVSU16(at, bt[0], ait) 3655 default: 3656 ModIterU16(at, bt, ait, bit) 3657 } 3658 return 3659 case Uint32: 3660 at := a.Uint32s() 3661 bt := b.Uint32s() 3662 switch { 3663 case as && bs: 3664 VecModU32(at, bt) 3665 case as && !bs: 3666 ModIterSVU32(at[0], bt, bit) 3667 case !as && bs: 3668 ModIterVSU32(at, bt[0], ait) 3669 default: 3670 ModIterU32(at, bt, ait, bit) 3671 } 3672 return 3673 case Uint64: 3674 at := a.Uint64s() 3675 bt := b.Uint64s() 3676 switch { 3677 case as && bs: 3678 VecModU64(at, bt) 3679 case as && !bs: 3680 ModIterSVU64(at[0], bt, bit) 3681 case !as && bs: 3682 ModIterVSU64(at, bt[0], ait) 3683 default: 3684 ModIterU64(at, bt, ait, bit) 3685 } 3686 return 3687 case Float32: 3688 at := a.Float32s() 3689 bt := b.Float32s() 3690 switch { 3691 case as && bs: 3692 VecModF32(at, bt) 3693 case as && !bs: 3694 ModIterSVF32(at[0], bt, bit) 3695 case !as && bs: 3696 ModIterVSF32(at, bt[0], ait) 3697 default: 3698 ModIterF32(at, bt, ait, bit) 3699 } 3700 return 3701 case Float64: 3702 at := a.Float64s() 3703 bt := b.Float64s() 3704 switch { 3705 case as && bs: 3706 VecModF64(at, bt) 3707 case as && !bs: 3708 ModIterSVF64(at[0], bt, bit) 3709 case !as && bs: 3710 ModIterVSF64(at, bt[0], ait) 3711 default: 3712 ModIterF64(at, bt, ait, bit) 3713 } 3714 return 3715 default: 3716 return errors.Errorf("Unsupported type %v for ModIter", t) 3717 } 3718 } 3719 3720 func (e E) AddIterIncr(t reflect.Type, a *storage.Header, b *storage.Header, incr *storage.Header, ait Iterator, bit Iterator, iit Iterator) (err error) { 3721 as := isScalar(a, t) 3722 bs := isScalar(b, t) 3723 is := isScalar(incr, t) 3724 3725 if ((as && !bs) || (bs && !as)) && is { 3726 return errors.Errorf("Cannot increment on a scalar increment. len(a): %d, len(b) %d", a.TypedLen(t), b.TypedLen(t)) 3727 } 3728 3729 switch t { 3730 case Int: 3731 at := a.Ints() 3732 bt := b.Ints() 3733 it := incr.Ints() 3734 switch { 3735 case as && bs: 3736 VecAddI(at, bt) 3737 if !is { 3738 return e.AddIter(t, incr, a, iit, ait) 3739 } 3740 it[0] += at[0] 3741 return 3742 case as && !bs: 3743 return AddIterIncrSVI(at[0], bt, it, bit, iit) 3744 case !as && bs: 3745 return AddIterIncrVSI(at, bt[0], it, ait, iit) 3746 default: 3747 return AddIterIncrI(at, bt, it, ait, bit, iit) 3748 } 3749 case Int8: 3750 at := a.Int8s() 3751 bt := b.Int8s() 3752 it := incr.Int8s() 3753 switch { 3754 case as && bs: 3755 VecAddI8(at, bt) 3756 if !is { 3757 return e.AddIter(t, incr, a, iit, ait) 3758 } 3759 it[0] += at[0] 3760 return 3761 case as && !bs: 3762 return AddIterIncrSVI8(at[0], bt, it, bit, iit) 3763 case !as && bs: 3764 return AddIterIncrVSI8(at, bt[0], it, ait, iit) 3765 default: 3766 return AddIterIncrI8(at, bt, it, ait, bit, iit) 3767 } 3768 case Int16: 3769 at := a.Int16s() 3770 bt := b.Int16s() 3771 it := incr.Int16s() 3772 switch { 3773 case as && bs: 3774 VecAddI16(at, bt) 3775 if !is { 3776 return e.AddIter(t, incr, a, iit, ait) 3777 } 3778 it[0] += at[0] 3779 return 3780 case as && !bs: 3781 return AddIterIncrSVI16(at[0], bt, it, bit, iit) 3782 case !as && bs: 3783 return AddIterIncrVSI16(at, bt[0], it, ait, iit) 3784 default: 3785 return AddIterIncrI16(at, bt, it, ait, bit, iit) 3786 } 3787 case Int32: 3788 at := a.Int32s() 3789 bt := b.Int32s() 3790 it := incr.Int32s() 3791 switch { 3792 case as && bs: 3793 VecAddI32(at, bt) 3794 if !is { 3795 return e.AddIter(t, incr, a, iit, ait) 3796 } 3797 it[0] += at[0] 3798 return 3799 case as && !bs: 3800 return AddIterIncrSVI32(at[0], bt, it, bit, iit) 3801 case !as && bs: 3802 return AddIterIncrVSI32(at, bt[0], it, ait, iit) 3803 default: 3804 return AddIterIncrI32(at, bt, it, ait, bit, iit) 3805 } 3806 case Int64: 3807 at := a.Int64s() 3808 bt := b.Int64s() 3809 it := incr.Int64s() 3810 switch { 3811 case as && bs: 3812 VecAddI64(at, bt) 3813 if !is { 3814 return e.AddIter(t, incr, a, iit, ait) 3815 } 3816 it[0] += at[0] 3817 return 3818 case as && !bs: 3819 return AddIterIncrSVI64(at[0], bt, it, bit, iit) 3820 case !as && bs: 3821 return AddIterIncrVSI64(at, bt[0], it, ait, iit) 3822 default: 3823 return AddIterIncrI64(at, bt, it, ait, bit, iit) 3824 } 3825 case Uint: 3826 at := a.Uints() 3827 bt := b.Uints() 3828 it := incr.Uints() 3829 switch { 3830 case as && bs: 3831 VecAddU(at, bt) 3832 if !is { 3833 return e.AddIter(t, incr, a, iit, ait) 3834 } 3835 it[0] += at[0] 3836 return 3837 case as && !bs: 3838 return AddIterIncrSVU(at[0], bt, it, bit, iit) 3839 case !as && bs: 3840 return AddIterIncrVSU(at, bt[0], it, ait, iit) 3841 default: 3842 return AddIterIncrU(at, bt, it, ait, bit, iit) 3843 } 3844 case Uint8: 3845 at := a.Uint8s() 3846 bt := b.Uint8s() 3847 it := incr.Uint8s() 3848 switch { 3849 case as && bs: 3850 VecAddU8(at, bt) 3851 if !is { 3852 return e.AddIter(t, incr, a, iit, ait) 3853 } 3854 it[0] += at[0] 3855 return 3856 case as && !bs: 3857 return AddIterIncrSVU8(at[0], bt, it, bit, iit) 3858 case !as && bs: 3859 return AddIterIncrVSU8(at, bt[0], it, ait, iit) 3860 default: 3861 return AddIterIncrU8(at, bt, it, ait, bit, iit) 3862 } 3863 case Uint16: 3864 at := a.Uint16s() 3865 bt := b.Uint16s() 3866 it := incr.Uint16s() 3867 switch { 3868 case as && bs: 3869 VecAddU16(at, bt) 3870 if !is { 3871 return e.AddIter(t, incr, a, iit, ait) 3872 } 3873 it[0] += at[0] 3874 return 3875 case as && !bs: 3876 return AddIterIncrSVU16(at[0], bt, it, bit, iit) 3877 case !as && bs: 3878 return AddIterIncrVSU16(at, bt[0], it, ait, iit) 3879 default: 3880 return AddIterIncrU16(at, bt, it, ait, bit, iit) 3881 } 3882 case Uint32: 3883 at := a.Uint32s() 3884 bt := b.Uint32s() 3885 it := incr.Uint32s() 3886 switch { 3887 case as && bs: 3888 VecAddU32(at, bt) 3889 if !is { 3890 return e.AddIter(t, incr, a, iit, ait) 3891 } 3892 it[0] += at[0] 3893 return 3894 case as && !bs: 3895 return AddIterIncrSVU32(at[0], bt, it, bit, iit) 3896 case !as && bs: 3897 return AddIterIncrVSU32(at, bt[0], it, ait, iit) 3898 default: 3899 return AddIterIncrU32(at, bt, it, ait, bit, iit) 3900 } 3901 case Uint64: 3902 at := a.Uint64s() 3903 bt := b.Uint64s() 3904 it := incr.Uint64s() 3905 switch { 3906 case as && bs: 3907 VecAddU64(at, bt) 3908 if !is { 3909 return e.AddIter(t, incr, a, iit, ait) 3910 } 3911 it[0] += at[0] 3912 return 3913 case as && !bs: 3914 return AddIterIncrSVU64(at[0], bt, it, bit, iit) 3915 case !as && bs: 3916 return AddIterIncrVSU64(at, bt[0], it, ait, iit) 3917 default: 3918 return AddIterIncrU64(at, bt, it, ait, bit, iit) 3919 } 3920 case Float32: 3921 at := a.Float32s() 3922 bt := b.Float32s() 3923 it := incr.Float32s() 3924 switch { 3925 case as && bs: 3926 VecAddF32(at, bt) 3927 if !is { 3928 return e.AddIter(t, incr, a, iit, ait) 3929 } 3930 it[0] += at[0] 3931 return 3932 case as && !bs: 3933 return AddIterIncrSVF32(at[0], bt, it, bit, iit) 3934 case !as && bs: 3935 return AddIterIncrVSF32(at, bt[0], it, ait, iit) 3936 default: 3937 return AddIterIncrF32(at, bt, it, ait, bit, iit) 3938 } 3939 case Float64: 3940 at := a.Float64s() 3941 bt := b.Float64s() 3942 it := incr.Float64s() 3943 switch { 3944 case as && bs: 3945 VecAddF64(at, bt) 3946 if !is { 3947 return e.AddIter(t, incr, a, iit, ait) 3948 } 3949 it[0] += at[0] 3950 return 3951 case as && !bs: 3952 return AddIterIncrSVF64(at[0], bt, it, bit, iit) 3953 case !as && bs: 3954 return AddIterIncrVSF64(at, bt[0], it, ait, iit) 3955 default: 3956 return AddIterIncrF64(at, bt, it, ait, bit, iit) 3957 } 3958 case Complex64: 3959 at := a.Complex64s() 3960 bt := b.Complex64s() 3961 it := incr.Complex64s() 3962 switch { 3963 case as && bs: 3964 VecAddC64(at, bt) 3965 if !is { 3966 return e.AddIter(t, incr, a, iit, ait) 3967 } 3968 it[0] += at[0] 3969 return 3970 case as && !bs: 3971 return AddIterIncrSVC64(at[0], bt, it, bit, iit) 3972 case !as && bs: 3973 return AddIterIncrVSC64(at, bt[0], it, ait, iit) 3974 default: 3975 return AddIterIncrC64(at, bt, it, ait, bit, iit) 3976 } 3977 case Complex128: 3978 at := a.Complex128s() 3979 bt := b.Complex128s() 3980 it := incr.Complex128s() 3981 switch { 3982 case as && bs: 3983 VecAddC128(at, bt) 3984 if !is { 3985 return e.AddIter(t, incr, a, iit, ait) 3986 } 3987 it[0] += at[0] 3988 return 3989 case as && !bs: 3990 return AddIterIncrSVC128(at[0], bt, it, bit, iit) 3991 case !as && bs: 3992 return AddIterIncrVSC128(at, bt[0], it, ait, iit) 3993 default: 3994 return AddIterIncrC128(at, bt, it, ait, bit, iit) 3995 } 3996 case String: 3997 at := a.Strings() 3998 bt := b.Strings() 3999 it := incr.Strings() 4000 switch { 4001 case as && bs: 4002 VecAddStr(at, bt) 4003 if !is { 4004 return e.AddIter(t, incr, a, iit, ait) 4005 } 4006 it[0] += at[0] 4007 return 4008 case as && !bs: 4009 return AddIterIncrSVStr(at[0], bt, it, bit, iit) 4010 case !as && bs: 4011 return AddIterIncrVSStr(at, bt[0], it, ait, iit) 4012 default: 4013 return AddIterIncrStr(at, bt, it, ait, bit, iit) 4014 } 4015 default: 4016 return errors.Errorf("Unsupported type %v for AddIterIncr", t) 4017 } 4018 } 4019 4020 func (e E) SubIterIncr(t reflect.Type, a *storage.Header, b *storage.Header, incr *storage.Header, ait Iterator, bit Iterator, iit Iterator) (err error) { 4021 as := isScalar(a, t) 4022 bs := isScalar(b, t) 4023 is := isScalar(incr, t) 4024 4025 if ((as && !bs) || (bs && !as)) && is { 4026 return errors.Errorf("Cannot increment on a scalar increment. len(a): %d, len(b) %d", a.TypedLen(t), b.TypedLen(t)) 4027 } 4028 4029 switch t { 4030 case Int: 4031 at := a.Ints() 4032 bt := b.Ints() 4033 it := incr.Ints() 4034 switch { 4035 case as && bs: 4036 VecSubI(at, bt) 4037 if !is { 4038 return e.SubIter(t, incr, a, iit, ait) 4039 } 4040 it[0] += at[0] 4041 return 4042 case as && !bs: 4043 return SubIterIncrSVI(at[0], bt, it, bit, iit) 4044 case !as && bs: 4045 return SubIterIncrVSI(at, bt[0], it, ait, iit) 4046 default: 4047 return SubIterIncrI(at, bt, it, ait, bit, iit) 4048 } 4049 case Int8: 4050 at := a.Int8s() 4051 bt := b.Int8s() 4052 it := incr.Int8s() 4053 switch { 4054 case as && bs: 4055 VecSubI8(at, bt) 4056 if !is { 4057 return e.SubIter(t, incr, a, iit, ait) 4058 } 4059 it[0] += at[0] 4060 return 4061 case as && !bs: 4062 return SubIterIncrSVI8(at[0], bt, it, bit, iit) 4063 case !as && bs: 4064 return SubIterIncrVSI8(at, bt[0], it, ait, iit) 4065 default: 4066 return SubIterIncrI8(at, bt, it, ait, bit, iit) 4067 } 4068 case Int16: 4069 at := a.Int16s() 4070 bt := b.Int16s() 4071 it := incr.Int16s() 4072 switch { 4073 case as && bs: 4074 VecSubI16(at, bt) 4075 if !is { 4076 return e.SubIter(t, incr, a, iit, ait) 4077 } 4078 it[0] += at[0] 4079 return 4080 case as && !bs: 4081 return SubIterIncrSVI16(at[0], bt, it, bit, iit) 4082 case !as && bs: 4083 return SubIterIncrVSI16(at, bt[0], it, ait, iit) 4084 default: 4085 return SubIterIncrI16(at, bt, it, ait, bit, iit) 4086 } 4087 case Int32: 4088 at := a.Int32s() 4089 bt := b.Int32s() 4090 it := incr.Int32s() 4091 switch { 4092 case as && bs: 4093 VecSubI32(at, bt) 4094 if !is { 4095 return e.SubIter(t, incr, a, iit, ait) 4096 } 4097 it[0] += at[0] 4098 return 4099 case as && !bs: 4100 return SubIterIncrSVI32(at[0], bt, it, bit, iit) 4101 case !as && bs: 4102 return SubIterIncrVSI32(at, bt[0], it, ait, iit) 4103 default: 4104 return SubIterIncrI32(at, bt, it, ait, bit, iit) 4105 } 4106 case Int64: 4107 at := a.Int64s() 4108 bt := b.Int64s() 4109 it := incr.Int64s() 4110 switch { 4111 case as && bs: 4112 VecSubI64(at, bt) 4113 if !is { 4114 return e.SubIter(t, incr, a, iit, ait) 4115 } 4116 it[0] += at[0] 4117 return 4118 case as && !bs: 4119 return SubIterIncrSVI64(at[0], bt, it, bit, iit) 4120 case !as && bs: 4121 return SubIterIncrVSI64(at, bt[0], it, ait, iit) 4122 default: 4123 return SubIterIncrI64(at, bt, it, ait, bit, iit) 4124 } 4125 case Uint: 4126 at := a.Uints() 4127 bt := b.Uints() 4128 it := incr.Uints() 4129 switch { 4130 case as && bs: 4131 VecSubU(at, bt) 4132 if !is { 4133 return e.SubIter(t, incr, a, iit, ait) 4134 } 4135 it[0] += at[0] 4136 return 4137 case as && !bs: 4138 return SubIterIncrSVU(at[0], bt, it, bit, iit) 4139 case !as && bs: 4140 return SubIterIncrVSU(at, bt[0], it, ait, iit) 4141 default: 4142 return SubIterIncrU(at, bt, it, ait, bit, iit) 4143 } 4144 case Uint8: 4145 at := a.Uint8s() 4146 bt := b.Uint8s() 4147 it := incr.Uint8s() 4148 switch { 4149 case as && bs: 4150 VecSubU8(at, bt) 4151 if !is { 4152 return e.SubIter(t, incr, a, iit, ait) 4153 } 4154 it[0] += at[0] 4155 return 4156 case as && !bs: 4157 return SubIterIncrSVU8(at[0], bt, it, bit, iit) 4158 case !as && bs: 4159 return SubIterIncrVSU8(at, bt[0], it, ait, iit) 4160 default: 4161 return SubIterIncrU8(at, bt, it, ait, bit, iit) 4162 } 4163 case Uint16: 4164 at := a.Uint16s() 4165 bt := b.Uint16s() 4166 it := incr.Uint16s() 4167 switch { 4168 case as && bs: 4169 VecSubU16(at, bt) 4170 if !is { 4171 return e.SubIter(t, incr, a, iit, ait) 4172 } 4173 it[0] += at[0] 4174 return 4175 case as && !bs: 4176 return SubIterIncrSVU16(at[0], bt, it, bit, iit) 4177 case !as && bs: 4178 return SubIterIncrVSU16(at, bt[0], it, ait, iit) 4179 default: 4180 return SubIterIncrU16(at, bt, it, ait, bit, iit) 4181 } 4182 case Uint32: 4183 at := a.Uint32s() 4184 bt := b.Uint32s() 4185 it := incr.Uint32s() 4186 switch { 4187 case as && bs: 4188 VecSubU32(at, bt) 4189 if !is { 4190 return e.SubIter(t, incr, a, iit, ait) 4191 } 4192 it[0] += at[0] 4193 return 4194 case as && !bs: 4195 return SubIterIncrSVU32(at[0], bt, it, bit, iit) 4196 case !as && bs: 4197 return SubIterIncrVSU32(at, bt[0], it, ait, iit) 4198 default: 4199 return SubIterIncrU32(at, bt, it, ait, bit, iit) 4200 } 4201 case Uint64: 4202 at := a.Uint64s() 4203 bt := b.Uint64s() 4204 it := incr.Uint64s() 4205 switch { 4206 case as && bs: 4207 VecSubU64(at, bt) 4208 if !is { 4209 return e.SubIter(t, incr, a, iit, ait) 4210 } 4211 it[0] += at[0] 4212 return 4213 case as && !bs: 4214 return SubIterIncrSVU64(at[0], bt, it, bit, iit) 4215 case !as && bs: 4216 return SubIterIncrVSU64(at, bt[0], it, ait, iit) 4217 default: 4218 return SubIterIncrU64(at, bt, it, ait, bit, iit) 4219 } 4220 case Float32: 4221 at := a.Float32s() 4222 bt := b.Float32s() 4223 it := incr.Float32s() 4224 switch { 4225 case as && bs: 4226 VecSubF32(at, bt) 4227 if !is { 4228 return e.SubIter(t, incr, a, iit, ait) 4229 } 4230 it[0] += at[0] 4231 return 4232 case as && !bs: 4233 return SubIterIncrSVF32(at[0], bt, it, bit, iit) 4234 case !as && bs: 4235 return SubIterIncrVSF32(at, bt[0], it, ait, iit) 4236 default: 4237 return SubIterIncrF32(at, bt, it, ait, bit, iit) 4238 } 4239 case Float64: 4240 at := a.Float64s() 4241 bt := b.Float64s() 4242 it := incr.Float64s() 4243 switch { 4244 case as && bs: 4245 VecSubF64(at, bt) 4246 if !is { 4247 return e.SubIter(t, incr, a, iit, ait) 4248 } 4249 it[0] += at[0] 4250 return 4251 case as && !bs: 4252 return SubIterIncrSVF64(at[0], bt, it, bit, iit) 4253 case !as && bs: 4254 return SubIterIncrVSF64(at, bt[0], it, ait, iit) 4255 default: 4256 return SubIterIncrF64(at, bt, it, ait, bit, iit) 4257 } 4258 case Complex64: 4259 at := a.Complex64s() 4260 bt := b.Complex64s() 4261 it := incr.Complex64s() 4262 switch { 4263 case as && bs: 4264 VecSubC64(at, bt) 4265 if !is { 4266 return e.SubIter(t, incr, a, iit, ait) 4267 } 4268 it[0] += at[0] 4269 return 4270 case as && !bs: 4271 return SubIterIncrSVC64(at[0], bt, it, bit, iit) 4272 case !as && bs: 4273 return SubIterIncrVSC64(at, bt[0], it, ait, iit) 4274 default: 4275 return SubIterIncrC64(at, bt, it, ait, bit, iit) 4276 } 4277 case Complex128: 4278 at := a.Complex128s() 4279 bt := b.Complex128s() 4280 it := incr.Complex128s() 4281 switch { 4282 case as && bs: 4283 VecSubC128(at, bt) 4284 if !is { 4285 return e.SubIter(t, incr, a, iit, ait) 4286 } 4287 it[0] += at[0] 4288 return 4289 case as && !bs: 4290 return SubIterIncrSVC128(at[0], bt, it, bit, iit) 4291 case !as && bs: 4292 return SubIterIncrVSC128(at, bt[0], it, ait, iit) 4293 default: 4294 return SubIterIncrC128(at, bt, it, ait, bit, iit) 4295 } 4296 default: 4297 return errors.Errorf("Unsupported type %v for SubIterIncr", t) 4298 } 4299 } 4300 4301 func (e E) MulIterIncr(t reflect.Type, a *storage.Header, b *storage.Header, incr *storage.Header, ait Iterator, bit Iterator, iit Iterator) (err error) { 4302 as := isScalar(a, t) 4303 bs := isScalar(b, t) 4304 is := isScalar(incr, t) 4305 4306 if ((as && !bs) || (bs && !as)) && is { 4307 return errors.Errorf("Cannot increment on a scalar increment. len(a): %d, len(b) %d", a.TypedLen(t), b.TypedLen(t)) 4308 } 4309 4310 switch t { 4311 case Int: 4312 at := a.Ints() 4313 bt := b.Ints() 4314 it := incr.Ints() 4315 switch { 4316 case as && bs: 4317 VecMulI(at, bt) 4318 if !is { 4319 return e.MulIter(t, incr, a, iit, ait) 4320 } 4321 it[0] += at[0] 4322 return 4323 case as && !bs: 4324 return MulIterIncrSVI(at[0], bt, it, bit, iit) 4325 case !as && bs: 4326 return MulIterIncrVSI(at, bt[0], it, ait, iit) 4327 default: 4328 return MulIterIncrI(at, bt, it, ait, bit, iit) 4329 } 4330 case Int8: 4331 at := a.Int8s() 4332 bt := b.Int8s() 4333 it := incr.Int8s() 4334 switch { 4335 case as && bs: 4336 VecMulI8(at, bt) 4337 if !is { 4338 return e.MulIter(t, incr, a, iit, ait) 4339 } 4340 it[0] += at[0] 4341 return 4342 case as && !bs: 4343 return MulIterIncrSVI8(at[0], bt, it, bit, iit) 4344 case !as && bs: 4345 return MulIterIncrVSI8(at, bt[0], it, ait, iit) 4346 default: 4347 return MulIterIncrI8(at, bt, it, ait, bit, iit) 4348 } 4349 case Int16: 4350 at := a.Int16s() 4351 bt := b.Int16s() 4352 it := incr.Int16s() 4353 switch { 4354 case as && bs: 4355 VecMulI16(at, bt) 4356 if !is { 4357 return e.MulIter(t, incr, a, iit, ait) 4358 } 4359 it[0] += at[0] 4360 return 4361 case as && !bs: 4362 return MulIterIncrSVI16(at[0], bt, it, bit, iit) 4363 case !as && bs: 4364 return MulIterIncrVSI16(at, bt[0], it, ait, iit) 4365 default: 4366 return MulIterIncrI16(at, bt, it, ait, bit, iit) 4367 } 4368 case Int32: 4369 at := a.Int32s() 4370 bt := b.Int32s() 4371 it := incr.Int32s() 4372 switch { 4373 case as && bs: 4374 VecMulI32(at, bt) 4375 if !is { 4376 return e.MulIter(t, incr, a, iit, ait) 4377 } 4378 it[0] += at[0] 4379 return 4380 case as && !bs: 4381 return MulIterIncrSVI32(at[0], bt, it, bit, iit) 4382 case !as && bs: 4383 return MulIterIncrVSI32(at, bt[0], it, ait, iit) 4384 default: 4385 return MulIterIncrI32(at, bt, it, ait, bit, iit) 4386 } 4387 case Int64: 4388 at := a.Int64s() 4389 bt := b.Int64s() 4390 it := incr.Int64s() 4391 switch { 4392 case as && bs: 4393 VecMulI64(at, bt) 4394 if !is { 4395 return e.MulIter(t, incr, a, iit, ait) 4396 } 4397 it[0] += at[0] 4398 return 4399 case as && !bs: 4400 return MulIterIncrSVI64(at[0], bt, it, bit, iit) 4401 case !as && bs: 4402 return MulIterIncrVSI64(at, bt[0], it, ait, iit) 4403 default: 4404 return MulIterIncrI64(at, bt, it, ait, bit, iit) 4405 } 4406 case Uint: 4407 at := a.Uints() 4408 bt := b.Uints() 4409 it := incr.Uints() 4410 switch { 4411 case as && bs: 4412 VecMulU(at, bt) 4413 if !is { 4414 return e.MulIter(t, incr, a, iit, ait) 4415 } 4416 it[0] += at[0] 4417 return 4418 case as && !bs: 4419 return MulIterIncrSVU(at[0], bt, it, bit, iit) 4420 case !as && bs: 4421 return MulIterIncrVSU(at, bt[0], it, ait, iit) 4422 default: 4423 return MulIterIncrU(at, bt, it, ait, bit, iit) 4424 } 4425 case Uint8: 4426 at := a.Uint8s() 4427 bt := b.Uint8s() 4428 it := incr.Uint8s() 4429 switch { 4430 case as && bs: 4431 VecMulU8(at, bt) 4432 if !is { 4433 return e.MulIter(t, incr, a, iit, ait) 4434 } 4435 it[0] += at[0] 4436 return 4437 case as && !bs: 4438 return MulIterIncrSVU8(at[0], bt, it, bit, iit) 4439 case !as && bs: 4440 return MulIterIncrVSU8(at, bt[0], it, ait, iit) 4441 default: 4442 return MulIterIncrU8(at, bt, it, ait, bit, iit) 4443 } 4444 case Uint16: 4445 at := a.Uint16s() 4446 bt := b.Uint16s() 4447 it := incr.Uint16s() 4448 switch { 4449 case as && bs: 4450 VecMulU16(at, bt) 4451 if !is { 4452 return e.MulIter(t, incr, a, iit, ait) 4453 } 4454 it[0] += at[0] 4455 return 4456 case as && !bs: 4457 return MulIterIncrSVU16(at[0], bt, it, bit, iit) 4458 case !as && bs: 4459 return MulIterIncrVSU16(at, bt[0], it, ait, iit) 4460 default: 4461 return MulIterIncrU16(at, bt, it, ait, bit, iit) 4462 } 4463 case Uint32: 4464 at := a.Uint32s() 4465 bt := b.Uint32s() 4466 it := incr.Uint32s() 4467 switch { 4468 case as && bs: 4469 VecMulU32(at, bt) 4470 if !is { 4471 return e.MulIter(t, incr, a, iit, ait) 4472 } 4473 it[0] += at[0] 4474 return 4475 case as && !bs: 4476 return MulIterIncrSVU32(at[0], bt, it, bit, iit) 4477 case !as && bs: 4478 return MulIterIncrVSU32(at, bt[0], it, ait, iit) 4479 default: 4480 return MulIterIncrU32(at, bt, it, ait, bit, iit) 4481 } 4482 case Uint64: 4483 at := a.Uint64s() 4484 bt := b.Uint64s() 4485 it := incr.Uint64s() 4486 switch { 4487 case as && bs: 4488 VecMulU64(at, bt) 4489 if !is { 4490 return e.MulIter(t, incr, a, iit, ait) 4491 } 4492 it[0] += at[0] 4493 return 4494 case as && !bs: 4495 return MulIterIncrSVU64(at[0], bt, it, bit, iit) 4496 case !as && bs: 4497 return MulIterIncrVSU64(at, bt[0], it, ait, iit) 4498 default: 4499 return MulIterIncrU64(at, bt, it, ait, bit, iit) 4500 } 4501 case Float32: 4502 at := a.Float32s() 4503 bt := b.Float32s() 4504 it := incr.Float32s() 4505 switch { 4506 case as && bs: 4507 VecMulF32(at, bt) 4508 if !is { 4509 return e.MulIter(t, incr, a, iit, ait) 4510 } 4511 it[0] += at[0] 4512 return 4513 case as && !bs: 4514 return MulIterIncrSVF32(at[0], bt, it, bit, iit) 4515 case !as && bs: 4516 return MulIterIncrVSF32(at, bt[0], it, ait, iit) 4517 default: 4518 return MulIterIncrF32(at, bt, it, ait, bit, iit) 4519 } 4520 case Float64: 4521 at := a.Float64s() 4522 bt := b.Float64s() 4523 it := incr.Float64s() 4524 switch { 4525 case as && bs: 4526 VecMulF64(at, bt) 4527 if !is { 4528 return e.MulIter(t, incr, a, iit, ait) 4529 } 4530 it[0] += at[0] 4531 return 4532 case as && !bs: 4533 return MulIterIncrSVF64(at[0], bt, it, bit, iit) 4534 case !as && bs: 4535 return MulIterIncrVSF64(at, bt[0], it, ait, iit) 4536 default: 4537 return MulIterIncrF64(at, bt, it, ait, bit, iit) 4538 } 4539 case Complex64: 4540 at := a.Complex64s() 4541 bt := b.Complex64s() 4542 it := incr.Complex64s() 4543 switch { 4544 case as && bs: 4545 VecMulC64(at, bt) 4546 if !is { 4547 return e.MulIter(t, incr, a, iit, ait) 4548 } 4549 it[0] += at[0] 4550 return 4551 case as && !bs: 4552 return MulIterIncrSVC64(at[0], bt, it, bit, iit) 4553 case !as && bs: 4554 return MulIterIncrVSC64(at, bt[0], it, ait, iit) 4555 default: 4556 return MulIterIncrC64(at, bt, it, ait, bit, iit) 4557 } 4558 case Complex128: 4559 at := a.Complex128s() 4560 bt := b.Complex128s() 4561 it := incr.Complex128s() 4562 switch { 4563 case as && bs: 4564 VecMulC128(at, bt) 4565 if !is { 4566 return e.MulIter(t, incr, a, iit, ait) 4567 } 4568 it[0] += at[0] 4569 return 4570 case as && !bs: 4571 return MulIterIncrSVC128(at[0], bt, it, bit, iit) 4572 case !as && bs: 4573 return MulIterIncrVSC128(at, bt[0], it, ait, iit) 4574 default: 4575 return MulIterIncrC128(at, bt, it, ait, bit, iit) 4576 } 4577 default: 4578 return errors.Errorf("Unsupported type %v for MulIterIncr", t) 4579 } 4580 } 4581 4582 func (e E) DivIterIncr(t reflect.Type, a *storage.Header, b *storage.Header, incr *storage.Header, ait Iterator, bit Iterator, iit Iterator) (err error) { 4583 as := isScalar(a, t) 4584 bs := isScalar(b, t) 4585 is := isScalar(incr, t) 4586 4587 if ((as && !bs) || (bs && !as)) && is { 4588 return errors.Errorf("Cannot increment on a scalar increment. len(a): %d, len(b) %d", a.TypedLen(t), b.TypedLen(t)) 4589 } 4590 4591 switch t { 4592 case Int: 4593 at := a.Ints() 4594 bt := b.Ints() 4595 it := incr.Ints() 4596 switch { 4597 case as && bs: 4598 VecDivI(at, bt) 4599 if !is { 4600 return e.DivIter(t, incr, a, iit, ait) 4601 } 4602 it[0] += at[0] 4603 return 4604 case as && !bs: 4605 return DivIterIncrSVI(at[0], bt, it, bit, iit) 4606 case !as && bs: 4607 return DivIterIncrVSI(at, bt[0], it, ait, iit) 4608 default: 4609 return DivIterIncrI(at, bt, it, ait, bit, iit) 4610 } 4611 case Int8: 4612 at := a.Int8s() 4613 bt := b.Int8s() 4614 it := incr.Int8s() 4615 switch { 4616 case as && bs: 4617 VecDivI8(at, bt) 4618 if !is { 4619 return e.DivIter(t, incr, a, iit, ait) 4620 } 4621 it[0] += at[0] 4622 return 4623 case as && !bs: 4624 return DivIterIncrSVI8(at[0], bt, it, bit, iit) 4625 case !as && bs: 4626 return DivIterIncrVSI8(at, bt[0], it, ait, iit) 4627 default: 4628 return DivIterIncrI8(at, bt, it, ait, bit, iit) 4629 } 4630 case Int16: 4631 at := a.Int16s() 4632 bt := b.Int16s() 4633 it := incr.Int16s() 4634 switch { 4635 case as && bs: 4636 VecDivI16(at, bt) 4637 if !is { 4638 return e.DivIter(t, incr, a, iit, ait) 4639 } 4640 it[0] += at[0] 4641 return 4642 case as && !bs: 4643 return DivIterIncrSVI16(at[0], bt, it, bit, iit) 4644 case !as && bs: 4645 return DivIterIncrVSI16(at, bt[0], it, ait, iit) 4646 default: 4647 return DivIterIncrI16(at, bt, it, ait, bit, iit) 4648 } 4649 case Int32: 4650 at := a.Int32s() 4651 bt := b.Int32s() 4652 it := incr.Int32s() 4653 switch { 4654 case as && bs: 4655 VecDivI32(at, bt) 4656 if !is { 4657 return e.DivIter(t, incr, a, iit, ait) 4658 } 4659 it[0] += at[0] 4660 return 4661 case as && !bs: 4662 return DivIterIncrSVI32(at[0], bt, it, bit, iit) 4663 case !as && bs: 4664 return DivIterIncrVSI32(at, bt[0], it, ait, iit) 4665 default: 4666 return DivIterIncrI32(at, bt, it, ait, bit, iit) 4667 } 4668 case Int64: 4669 at := a.Int64s() 4670 bt := b.Int64s() 4671 it := incr.Int64s() 4672 switch { 4673 case as && bs: 4674 VecDivI64(at, bt) 4675 if !is { 4676 return e.DivIter(t, incr, a, iit, ait) 4677 } 4678 it[0] += at[0] 4679 return 4680 case as && !bs: 4681 return DivIterIncrSVI64(at[0], bt, it, bit, iit) 4682 case !as && bs: 4683 return DivIterIncrVSI64(at, bt[0], it, ait, iit) 4684 default: 4685 return DivIterIncrI64(at, bt, it, ait, bit, iit) 4686 } 4687 case Uint: 4688 at := a.Uints() 4689 bt := b.Uints() 4690 it := incr.Uints() 4691 switch { 4692 case as && bs: 4693 VecDivU(at, bt) 4694 if !is { 4695 return e.DivIter(t, incr, a, iit, ait) 4696 } 4697 it[0] += at[0] 4698 return 4699 case as && !bs: 4700 return DivIterIncrSVU(at[0], bt, it, bit, iit) 4701 case !as && bs: 4702 return DivIterIncrVSU(at, bt[0], it, ait, iit) 4703 default: 4704 return DivIterIncrU(at, bt, it, ait, bit, iit) 4705 } 4706 case Uint8: 4707 at := a.Uint8s() 4708 bt := b.Uint8s() 4709 it := incr.Uint8s() 4710 switch { 4711 case as && bs: 4712 VecDivU8(at, bt) 4713 if !is { 4714 return e.DivIter(t, incr, a, iit, ait) 4715 } 4716 it[0] += at[0] 4717 return 4718 case as && !bs: 4719 return DivIterIncrSVU8(at[0], bt, it, bit, iit) 4720 case !as && bs: 4721 return DivIterIncrVSU8(at, bt[0], it, ait, iit) 4722 default: 4723 return DivIterIncrU8(at, bt, it, ait, bit, iit) 4724 } 4725 case Uint16: 4726 at := a.Uint16s() 4727 bt := b.Uint16s() 4728 it := incr.Uint16s() 4729 switch { 4730 case as && bs: 4731 VecDivU16(at, bt) 4732 if !is { 4733 return e.DivIter(t, incr, a, iit, ait) 4734 } 4735 it[0] += at[0] 4736 return 4737 case as && !bs: 4738 return DivIterIncrSVU16(at[0], bt, it, bit, iit) 4739 case !as && bs: 4740 return DivIterIncrVSU16(at, bt[0], it, ait, iit) 4741 default: 4742 return DivIterIncrU16(at, bt, it, ait, bit, iit) 4743 } 4744 case Uint32: 4745 at := a.Uint32s() 4746 bt := b.Uint32s() 4747 it := incr.Uint32s() 4748 switch { 4749 case as && bs: 4750 VecDivU32(at, bt) 4751 if !is { 4752 return e.DivIter(t, incr, a, iit, ait) 4753 } 4754 it[0] += at[0] 4755 return 4756 case as && !bs: 4757 return DivIterIncrSVU32(at[0], bt, it, bit, iit) 4758 case !as && bs: 4759 return DivIterIncrVSU32(at, bt[0], it, ait, iit) 4760 default: 4761 return DivIterIncrU32(at, bt, it, ait, bit, iit) 4762 } 4763 case Uint64: 4764 at := a.Uint64s() 4765 bt := b.Uint64s() 4766 it := incr.Uint64s() 4767 switch { 4768 case as && bs: 4769 VecDivU64(at, bt) 4770 if !is { 4771 return e.DivIter(t, incr, a, iit, ait) 4772 } 4773 it[0] += at[0] 4774 return 4775 case as && !bs: 4776 return DivIterIncrSVU64(at[0], bt, it, bit, iit) 4777 case !as && bs: 4778 return DivIterIncrVSU64(at, bt[0], it, ait, iit) 4779 default: 4780 return DivIterIncrU64(at, bt, it, ait, bit, iit) 4781 } 4782 case Float32: 4783 at := a.Float32s() 4784 bt := b.Float32s() 4785 it := incr.Float32s() 4786 switch { 4787 case as && bs: 4788 VecDivF32(at, bt) 4789 if !is { 4790 return e.DivIter(t, incr, a, iit, ait) 4791 } 4792 it[0] += at[0] 4793 return 4794 case as && !bs: 4795 return DivIterIncrSVF32(at[0], bt, it, bit, iit) 4796 case !as && bs: 4797 return DivIterIncrVSF32(at, bt[0], it, ait, iit) 4798 default: 4799 return DivIterIncrF32(at, bt, it, ait, bit, iit) 4800 } 4801 case Float64: 4802 at := a.Float64s() 4803 bt := b.Float64s() 4804 it := incr.Float64s() 4805 switch { 4806 case as && bs: 4807 VecDivF64(at, bt) 4808 if !is { 4809 return e.DivIter(t, incr, a, iit, ait) 4810 } 4811 it[0] += at[0] 4812 return 4813 case as && !bs: 4814 return DivIterIncrSVF64(at[0], bt, it, bit, iit) 4815 case !as && bs: 4816 return DivIterIncrVSF64(at, bt[0], it, ait, iit) 4817 default: 4818 return DivIterIncrF64(at, bt, it, ait, bit, iit) 4819 } 4820 case Complex64: 4821 at := a.Complex64s() 4822 bt := b.Complex64s() 4823 it := incr.Complex64s() 4824 switch { 4825 case as && bs: 4826 VecDivC64(at, bt) 4827 if !is { 4828 return e.DivIter(t, incr, a, iit, ait) 4829 } 4830 it[0] += at[0] 4831 return 4832 case as && !bs: 4833 return DivIterIncrSVC64(at[0], bt, it, bit, iit) 4834 case !as && bs: 4835 return DivIterIncrVSC64(at, bt[0], it, ait, iit) 4836 default: 4837 return DivIterIncrC64(at, bt, it, ait, bit, iit) 4838 } 4839 case Complex128: 4840 at := a.Complex128s() 4841 bt := b.Complex128s() 4842 it := incr.Complex128s() 4843 switch { 4844 case as && bs: 4845 VecDivC128(at, bt) 4846 if !is { 4847 return e.DivIter(t, incr, a, iit, ait) 4848 } 4849 it[0] += at[0] 4850 return 4851 case as && !bs: 4852 return DivIterIncrSVC128(at[0], bt, it, bit, iit) 4853 case !as && bs: 4854 return DivIterIncrVSC128(at, bt[0], it, ait, iit) 4855 default: 4856 return DivIterIncrC128(at, bt, it, ait, bit, iit) 4857 } 4858 default: 4859 return errors.Errorf("Unsupported type %v for DivIterIncr", t) 4860 } 4861 } 4862 4863 func (e E) PowIterIncr(t reflect.Type, a *storage.Header, b *storage.Header, incr *storage.Header, ait Iterator, bit Iterator, iit Iterator) (err error) { 4864 as := isScalar(a, t) 4865 bs := isScalar(b, t) 4866 is := isScalar(incr, t) 4867 4868 if ((as && !bs) || (bs && !as)) && is { 4869 return errors.Errorf("Cannot increment on a scalar increment. len(a): %d, len(b) %d", a.TypedLen(t), b.TypedLen(t)) 4870 } 4871 4872 switch t { 4873 case Float32: 4874 at := a.Float32s() 4875 bt := b.Float32s() 4876 it := incr.Float32s() 4877 switch { 4878 case as && bs: 4879 VecPowF32(at, bt) 4880 if !is { 4881 return e.PowIter(t, incr, a, iit, ait) 4882 } 4883 it[0] += at[0] 4884 return 4885 case as && !bs: 4886 return PowIterIncrSVF32(at[0], bt, it, bit, iit) 4887 case !as && bs: 4888 return PowIterIncrVSF32(at, bt[0], it, ait, iit) 4889 default: 4890 return PowIterIncrF32(at, bt, it, ait, bit, iit) 4891 } 4892 case Float64: 4893 at := a.Float64s() 4894 bt := b.Float64s() 4895 it := incr.Float64s() 4896 switch { 4897 case as && bs: 4898 VecPowF64(at, bt) 4899 if !is { 4900 return e.PowIter(t, incr, a, iit, ait) 4901 } 4902 it[0] += at[0] 4903 return 4904 case as && !bs: 4905 return PowIterIncrSVF64(at[0], bt, it, bit, iit) 4906 case !as && bs: 4907 return PowIterIncrVSF64(at, bt[0], it, ait, iit) 4908 default: 4909 return PowIterIncrF64(at, bt, it, ait, bit, iit) 4910 } 4911 case Complex64: 4912 at := a.Complex64s() 4913 bt := b.Complex64s() 4914 it := incr.Complex64s() 4915 switch { 4916 case as && bs: 4917 VecPowC64(at, bt) 4918 if !is { 4919 return e.PowIter(t, incr, a, iit, ait) 4920 } 4921 it[0] += at[0] 4922 return 4923 case as && !bs: 4924 return PowIterIncrSVC64(at[0], bt, it, bit, iit) 4925 case !as && bs: 4926 return PowIterIncrVSC64(at, bt[0], it, ait, iit) 4927 default: 4928 return PowIterIncrC64(at, bt, it, ait, bit, iit) 4929 } 4930 case Complex128: 4931 at := a.Complex128s() 4932 bt := b.Complex128s() 4933 it := incr.Complex128s() 4934 switch { 4935 case as && bs: 4936 VecPowC128(at, bt) 4937 if !is { 4938 return e.PowIter(t, incr, a, iit, ait) 4939 } 4940 it[0] += at[0] 4941 return 4942 case as && !bs: 4943 return PowIterIncrSVC128(at[0], bt, it, bit, iit) 4944 case !as && bs: 4945 return PowIterIncrVSC128(at, bt[0], it, ait, iit) 4946 default: 4947 return PowIterIncrC128(at, bt, it, ait, bit, iit) 4948 } 4949 default: 4950 return errors.Errorf("Unsupported type %v for PowIterIncr", t) 4951 } 4952 } 4953 4954 func (e E) ModIterIncr(t reflect.Type, a *storage.Header, b *storage.Header, incr *storage.Header, ait Iterator, bit Iterator, iit Iterator) (err error) { 4955 as := isScalar(a, t) 4956 bs := isScalar(b, t) 4957 is := isScalar(incr, t) 4958 4959 if ((as && !bs) || (bs && !as)) && is { 4960 return errors.Errorf("Cannot increment on a scalar increment. len(a): %d, len(b) %d", a.TypedLen(t), b.TypedLen(t)) 4961 } 4962 4963 switch t { 4964 case Int: 4965 at := a.Ints() 4966 bt := b.Ints() 4967 it := incr.Ints() 4968 switch { 4969 case as && bs: 4970 VecModI(at, bt) 4971 if !is { 4972 return e.ModIter(t, incr, a, iit, ait) 4973 } 4974 it[0] += at[0] 4975 return 4976 case as && !bs: 4977 return ModIterIncrSVI(at[0], bt, it, bit, iit) 4978 case !as && bs: 4979 return ModIterIncrVSI(at, bt[0], it, ait, iit) 4980 default: 4981 return ModIterIncrI(at, bt, it, ait, bit, iit) 4982 } 4983 case Int8: 4984 at := a.Int8s() 4985 bt := b.Int8s() 4986 it := incr.Int8s() 4987 switch { 4988 case as && bs: 4989 VecModI8(at, bt) 4990 if !is { 4991 return e.ModIter(t, incr, a, iit, ait) 4992 } 4993 it[0] += at[0] 4994 return 4995 case as && !bs: 4996 return ModIterIncrSVI8(at[0], bt, it, bit, iit) 4997 case !as && bs: 4998 return ModIterIncrVSI8(at, bt[0], it, ait, iit) 4999 default: 5000 return ModIterIncrI8(at, bt, it, ait, bit, iit) 5001 } 5002 case Int16: 5003 at := a.Int16s() 5004 bt := b.Int16s() 5005 it := incr.Int16s() 5006 switch { 5007 case as && bs: 5008 VecModI16(at, bt) 5009 if !is { 5010 return e.ModIter(t, incr, a, iit, ait) 5011 } 5012 it[0] += at[0] 5013 return 5014 case as && !bs: 5015 return ModIterIncrSVI16(at[0], bt, it, bit, iit) 5016 case !as && bs: 5017 return ModIterIncrVSI16(at, bt[0], it, ait, iit) 5018 default: 5019 return ModIterIncrI16(at, bt, it, ait, bit, iit) 5020 } 5021 case Int32: 5022 at := a.Int32s() 5023 bt := b.Int32s() 5024 it := incr.Int32s() 5025 switch { 5026 case as && bs: 5027 VecModI32(at, bt) 5028 if !is { 5029 return e.ModIter(t, incr, a, iit, ait) 5030 } 5031 it[0] += at[0] 5032 return 5033 case as && !bs: 5034 return ModIterIncrSVI32(at[0], bt, it, bit, iit) 5035 case !as && bs: 5036 return ModIterIncrVSI32(at, bt[0], it, ait, iit) 5037 default: 5038 return ModIterIncrI32(at, bt, it, ait, bit, iit) 5039 } 5040 case Int64: 5041 at := a.Int64s() 5042 bt := b.Int64s() 5043 it := incr.Int64s() 5044 switch { 5045 case as && bs: 5046 VecModI64(at, bt) 5047 if !is { 5048 return e.ModIter(t, incr, a, iit, ait) 5049 } 5050 it[0] += at[0] 5051 return 5052 case as && !bs: 5053 return ModIterIncrSVI64(at[0], bt, it, bit, iit) 5054 case !as && bs: 5055 return ModIterIncrVSI64(at, bt[0], it, ait, iit) 5056 default: 5057 return ModIterIncrI64(at, bt, it, ait, bit, iit) 5058 } 5059 case Uint: 5060 at := a.Uints() 5061 bt := b.Uints() 5062 it := incr.Uints() 5063 switch { 5064 case as && bs: 5065 VecModU(at, bt) 5066 if !is { 5067 return e.ModIter(t, incr, a, iit, ait) 5068 } 5069 it[0] += at[0] 5070 return 5071 case as && !bs: 5072 return ModIterIncrSVU(at[0], bt, it, bit, iit) 5073 case !as && bs: 5074 return ModIterIncrVSU(at, bt[0], it, ait, iit) 5075 default: 5076 return ModIterIncrU(at, bt, it, ait, bit, iit) 5077 } 5078 case Uint8: 5079 at := a.Uint8s() 5080 bt := b.Uint8s() 5081 it := incr.Uint8s() 5082 switch { 5083 case as && bs: 5084 VecModU8(at, bt) 5085 if !is { 5086 return e.ModIter(t, incr, a, iit, ait) 5087 } 5088 it[0] += at[0] 5089 return 5090 case as && !bs: 5091 return ModIterIncrSVU8(at[0], bt, it, bit, iit) 5092 case !as && bs: 5093 return ModIterIncrVSU8(at, bt[0], it, ait, iit) 5094 default: 5095 return ModIterIncrU8(at, bt, it, ait, bit, iit) 5096 } 5097 case Uint16: 5098 at := a.Uint16s() 5099 bt := b.Uint16s() 5100 it := incr.Uint16s() 5101 switch { 5102 case as && bs: 5103 VecModU16(at, bt) 5104 if !is { 5105 return e.ModIter(t, incr, a, iit, ait) 5106 } 5107 it[0] += at[0] 5108 return 5109 case as && !bs: 5110 return ModIterIncrSVU16(at[0], bt, it, bit, iit) 5111 case !as && bs: 5112 return ModIterIncrVSU16(at, bt[0], it, ait, iit) 5113 default: 5114 return ModIterIncrU16(at, bt, it, ait, bit, iit) 5115 } 5116 case Uint32: 5117 at := a.Uint32s() 5118 bt := b.Uint32s() 5119 it := incr.Uint32s() 5120 switch { 5121 case as && bs: 5122 VecModU32(at, bt) 5123 if !is { 5124 return e.ModIter(t, incr, a, iit, ait) 5125 } 5126 it[0] += at[0] 5127 return 5128 case as && !bs: 5129 return ModIterIncrSVU32(at[0], bt, it, bit, iit) 5130 case !as && bs: 5131 return ModIterIncrVSU32(at, bt[0], it, ait, iit) 5132 default: 5133 return ModIterIncrU32(at, bt, it, ait, bit, iit) 5134 } 5135 case Uint64: 5136 at := a.Uint64s() 5137 bt := b.Uint64s() 5138 it := incr.Uint64s() 5139 switch { 5140 case as && bs: 5141 VecModU64(at, bt) 5142 if !is { 5143 return e.ModIter(t, incr, a, iit, ait) 5144 } 5145 it[0] += at[0] 5146 return 5147 case as && !bs: 5148 return ModIterIncrSVU64(at[0], bt, it, bit, iit) 5149 case !as && bs: 5150 return ModIterIncrVSU64(at, bt[0], it, ait, iit) 5151 default: 5152 return ModIterIncrU64(at, bt, it, ait, bit, iit) 5153 } 5154 case Float32: 5155 at := a.Float32s() 5156 bt := b.Float32s() 5157 it := incr.Float32s() 5158 switch { 5159 case as && bs: 5160 VecModF32(at, bt) 5161 if !is { 5162 return e.ModIter(t, incr, a, iit, ait) 5163 } 5164 it[0] += at[0] 5165 return 5166 case as && !bs: 5167 return ModIterIncrSVF32(at[0], bt, it, bit, iit) 5168 case !as && bs: 5169 return ModIterIncrVSF32(at, bt[0], it, ait, iit) 5170 default: 5171 return ModIterIncrF32(at, bt, it, ait, bit, iit) 5172 } 5173 case Float64: 5174 at := a.Float64s() 5175 bt := b.Float64s() 5176 it := incr.Float64s() 5177 switch { 5178 case as && bs: 5179 VecModF64(at, bt) 5180 if !is { 5181 return e.ModIter(t, incr, a, iit, ait) 5182 } 5183 it[0] += at[0] 5184 return 5185 case as && !bs: 5186 return ModIterIncrSVF64(at[0], bt, it, bit, iit) 5187 case !as && bs: 5188 return ModIterIncrVSF64(at, bt[0], it, ait, iit) 5189 default: 5190 return ModIterIncrF64(at, bt, it, ait, bit, iit) 5191 } 5192 default: 5193 return errors.Errorf("Unsupported type %v for ModIterIncr", t) 5194 } 5195 } 5196 5197 func (e E) AddRecv(t reflect.Type, a *storage.Header, b *storage.Header, recv *storage.Header) (err error) { 5198 as := isScalar(a, t) 5199 bs := isScalar(b, t) 5200 rs := isScalar(recv, t) 5201 5202 if ((as && !bs) || (bs && !as)) && rs { 5203 return errors.Errorf("Cannot increment on a scalar increment. len(a): %d, len(b) %d", a.TypedLen(t), b.TypedLen(t)) 5204 } 5205 5206 switch t { 5207 case Int: 5208 at := a.Ints() 5209 bt := b.Ints() 5210 rt := recv.Ints() 5211 AddRecvI(at, bt, rt) 5212 return 5213 case Int8: 5214 at := a.Int8s() 5215 bt := b.Int8s() 5216 rt := recv.Int8s() 5217 AddRecvI8(at, bt, rt) 5218 return 5219 case Int16: 5220 at := a.Int16s() 5221 bt := b.Int16s() 5222 rt := recv.Int16s() 5223 AddRecvI16(at, bt, rt) 5224 return 5225 case Int32: 5226 at := a.Int32s() 5227 bt := b.Int32s() 5228 rt := recv.Int32s() 5229 AddRecvI32(at, bt, rt) 5230 return 5231 case Int64: 5232 at := a.Int64s() 5233 bt := b.Int64s() 5234 rt := recv.Int64s() 5235 AddRecvI64(at, bt, rt) 5236 return 5237 case Uint: 5238 at := a.Uints() 5239 bt := b.Uints() 5240 rt := recv.Uints() 5241 AddRecvU(at, bt, rt) 5242 return 5243 case Uint8: 5244 at := a.Uint8s() 5245 bt := b.Uint8s() 5246 rt := recv.Uint8s() 5247 AddRecvU8(at, bt, rt) 5248 return 5249 case Uint16: 5250 at := a.Uint16s() 5251 bt := b.Uint16s() 5252 rt := recv.Uint16s() 5253 AddRecvU16(at, bt, rt) 5254 return 5255 case Uint32: 5256 at := a.Uint32s() 5257 bt := b.Uint32s() 5258 rt := recv.Uint32s() 5259 AddRecvU32(at, bt, rt) 5260 return 5261 case Uint64: 5262 at := a.Uint64s() 5263 bt := b.Uint64s() 5264 rt := recv.Uint64s() 5265 AddRecvU64(at, bt, rt) 5266 return 5267 case Float32: 5268 at := a.Float32s() 5269 bt := b.Float32s() 5270 rt := recv.Float32s() 5271 AddRecvF32(at, bt, rt) 5272 return 5273 case Float64: 5274 at := a.Float64s() 5275 bt := b.Float64s() 5276 rt := recv.Float64s() 5277 AddRecvF64(at, bt, rt) 5278 return 5279 case Complex64: 5280 at := a.Complex64s() 5281 bt := b.Complex64s() 5282 rt := recv.Complex64s() 5283 AddRecvC64(at, bt, rt) 5284 return 5285 case Complex128: 5286 at := a.Complex128s() 5287 bt := b.Complex128s() 5288 rt := recv.Complex128s() 5289 AddRecvC128(at, bt, rt) 5290 return 5291 case String: 5292 at := a.Strings() 5293 bt := b.Strings() 5294 rt := recv.Strings() 5295 AddRecvStr(at, bt, rt) 5296 return 5297 default: 5298 return errors.Errorf("Unsupported type %v for AddRecv", t) 5299 } 5300 } 5301 5302 func (e E) SubRecv(t reflect.Type, a *storage.Header, b *storage.Header, recv *storage.Header) (err error) { 5303 as := isScalar(a, t) 5304 bs := isScalar(b, t) 5305 rs := isScalar(recv, t) 5306 5307 if ((as && !bs) || (bs && !as)) && rs { 5308 return errors.Errorf("Cannot increment on a scalar increment. len(a): %d, len(b) %d", a.TypedLen(t), b.TypedLen(t)) 5309 } 5310 5311 switch t { 5312 case Int: 5313 at := a.Ints() 5314 bt := b.Ints() 5315 rt := recv.Ints() 5316 SubRecvI(at, bt, rt) 5317 return 5318 case Int8: 5319 at := a.Int8s() 5320 bt := b.Int8s() 5321 rt := recv.Int8s() 5322 SubRecvI8(at, bt, rt) 5323 return 5324 case Int16: 5325 at := a.Int16s() 5326 bt := b.Int16s() 5327 rt := recv.Int16s() 5328 SubRecvI16(at, bt, rt) 5329 return 5330 case Int32: 5331 at := a.Int32s() 5332 bt := b.Int32s() 5333 rt := recv.Int32s() 5334 SubRecvI32(at, bt, rt) 5335 return 5336 case Int64: 5337 at := a.Int64s() 5338 bt := b.Int64s() 5339 rt := recv.Int64s() 5340 SubRecvI64(at, bt, rt) 5341 return 5342 case Uint: 5343 at := a.Uints() 5344 bt := b.Uints() 5345 rt := recv.Uints() 5346 SubRecvU(at, bt, rt) 5347 return 5348 case Uint8: 5349 at := a.Uint8s() 5350 bt := b.Uint8s() 5351 rt := recv.Uint8s() 5352 SubRecvU8(at, bt, rt) 5353 return 5354 case Uint16: 5355 at := a.Uint16s() 5356 bt := b.Uint16s() 5357 rt := recv.Uint16s() 5358 SubRecvU16(at, bt, rt) 5359 return 5360 case Uint32: 5361 at := a.Uint32s() 5362 bt := b.Uint32s() 5363 rt := recv.Uint32s() 5364 SubRecvU32(at, bt, rt) 5365 return 5366 case Uint64: 5367 at := a.Uint64s() 5368 bt := b.Uint64s() 5369 rt := recv.Uint64s() 5370 SubRecvU64(at, bt, rt) 5371 return 5372 case Float32: 5373 at := a.Float32s() 5374 bt := b.Float32s() 5375 rt := recv.Float32s() 5376 SubRecvF32(at, bt, rt) 5377 return 5378 case Float64: 5379 at := a.Float64s() 5380 bt := b.Float64s() 5381 rt := recv.Float64s() 5382 SubRecvF64(at, bt, rt) 5383 return 5384 case Complex64: 5385 at := a.Complex64s() 5386 bt := b.Complex64s() 5387 rt := recv.Complex64s() 5388 SubRecvC64(at, bt, rt) 5389 return 5390 case Complex128: 5391 at := a.Complex128s() 5392 bt := b.Complex128s() 5393 rt := recv.Complex128s() 5394 SubRecvC128(at, bt, rt) 5395 return 5396 default: 5397 return errors.Errorf("Unsupported type %v for SubRecv", t) 5398 } 5399 } 5400 5401 func (e E) MulRecv(t reflect.Type, a *storage.Header, b *storage.Header, recv *storage.Header) (err error) { 5402 as := isScalar(a, t) 5403 bs := isScalar(b, t) 5404 rs := isScalar(recv, t) 5405 5406 if ((as && !bs) || (bs && !as)) && rs { 5407 return errors.Errorf("Cannot increment on a scalar increment. len(a): %d, len(b) %d", a.TypedLen(t), b.TypedLen(t)) 5408 } 5409 5410 switch t { 5411 case Int: 5412 at := a.Ints() 5413 bt := b.Ints() 5414 rt := recv.Ints() 5415 MulRecvI(at, bt, rt) 5416 return 5417 case Int8: 5418 at := a.Int8s() 5419 bt := b.Int8s() 5420 rt := recv.Int8s() 5421 MulRecvI8(at, bt, rt) 5422 return 5423 case Int16: 5424 at := a.Int16s() 5425 bt := b.Int16s() 5426 rt := recv.Int16s() 5427 MulRecvI16(at, bt, rt) 5428 return 5429 case Int32: 5430 at := a.Int32s() 5431 bt := b.Int32s() 5432 rt := recv.Int32s() 5433 MulRecvI32(at, bt, rt) 5434 return 5435 case Int64: 5436 at := a.Int64s() 5437 bt := b.Int64s() 5438 rt := recv.Int64s() 5439 MulRecvI64(at, bt, rt) 5440 return 5441 case Uint: 5442 at := a.Uints() 5443 bt := b.Uints() 5444 rt := recv.Uints() 5445 MulRecvU(at, bt, rt) 5446 return 5447 case Uint8: 5448 at := a.Uint8s() 5449 bt := b.Uint8s() 5450 rt := recv.Uint8s() 5451 MulRecvU8(at, bt, rt) 5452 return 5453 case Uint16: 5454 at := a.Uint16s() 5455 bt := b.Uint16s() 5456 rt := recv.Uint16s() 5457 MulRecvU16(at, bt, rt) 5458 return 5459 case Uint32: 5460 at := a.Uint32s() 5461 bt := b.Uint32s() 5462 rt := recv.Uint32s() 5463 MulRecvU32(at, bt, rt) 5464 return 5465 case Uint64: 5466 at := a.Uint64s() 5467 bt := b.Uint64s() 5468 rt := recv.Uint64s() 5469 MulRecvU64(at, bt, rt) 5470 return 5471 case Float32: 5472 at := a.Float32s() 5473 bt := b.Float32s() 5474 rt := recv.Float32s() 5475 MulRecvF32(at, bt, rt) 5476 return 5477 case Float64: 5478 at := a.Float64s() 5479 bt := b.Float64s() 5480 rt := recv.Float64s() 5481 MulRecvF64(at, bt, rt) 5482 return 5483 case Complex64: 5484 at := a.Complex64s() 5485 bt := b.Complex64s() 5486 rt := recv.Complex64s() 5487 MulRecvC64(at, bt, rt) 5488 return 5489 case Complex128: 5490 at := a.Complex128s() 5491 bt := b.Complex128s() 5492 rt := recv.Complex128s() 5493 MulRecvC128(at, bt, rt) 5494 return 5495 default: 5496 return errors.Errorf("Unsupported type %v for MulRecv", t) 5497 } 5498 } 5499 5500 func (e E) DivRecv(t reflect.Type, a *storage.Header, b *storage.Header, recv *storage.Header) (err error) { 5501 as := isScalar(a, t) 5502 bs := isScalar(b, t) 5503 rs := isScalar(recv, t) 5504 5505 if ((as && !bs) || (bs && !as)) && rs { 5506 return errors.Errorf("Cannot increment on a scalar increment. len(a): %d, len(b) %d", a.TypedLen(t), b.TypedLen(t)) 5507 } 5508 5509 switch t { 5510 case Int: 5511 at := a.Ints() 5512 bt := b.Ints() 5513 rt := recv.Ints() 5514 DivRecvI(at, bt, rt) 5515 return 5516 case Int8: 5517 at := a.Int8s() 5518 bt := b.Int8s() 5519 rt := recv.Int8s() 5520 DivRecvI8(at, bt, rt) 5521 return 5522 case Int16: 5523 at := a.Int16s() 5524 bt := b.Int16s() 5525 rt := recv.Int16s() 5526 DivRecvI16(at, bt, rt) 5527 return 5528 case Int32: 5529 at := a.Int32s() 5530 bt := b.Int32s() 5531 rt := recv.Int32s() 5532 DivRecvI32(at, bt, rt) 5533 return 5534 case Int64: 5535 at := a.Int64s() 5536 bt := b.Int64s() 5537 rt := recv.Int64s() 5538 DivRecvI64(at, bt, rt) 5539 return 5540 case Uint: 5541 at := a.Uints() 5542 bt := b.Uints() 5543 rt := recv.Uints() 5544 DivRecvU(at, bt, rt) 5545 return 5546 case Uint8: 5547 at := a.Uint8s() 5548 bt := b.Uint8s() 5549 rt := recv.Uint8s() 5550 DivRecvU8(at, bt, rt) 5551 return 5552 case Uint16: 5553 at := a.Uint16s() 5554 bt := b.Uint16s() 5555 rt := recv.Uint16s() 5556 DivRecvU16(at, bt, rt) 5557 return 5558 case Uint32: 5559 at := a.Uint32s() 5560 bt := b.Uint32s() 5561 rt := recv.Uint32s() 5562 DivRecvU32(at, bt, rt) 5563 return 5564 case Uint64: 5565 at := a.Uint64s() 5566 bt := b.Uint64s() 5567 rt := recv.Uint64s() 5568 DivRecvU64(at, bt, rt) 5569 return 5570 case Float32: 5571 at := a.Float32s() 5572 bt := b.Float32s() 5573 rt := recv.Float32s() 5574 DivRecvF32(at, bt, rt) 5575 return 5576 case Float64: 5577 at := a.Float64s() 5578 bt := b.Float64s() 5579 rt := recv.Float64s() 5580 DivRecvF64(at, bt, rt) 5581 return 5582 case Complex64: 5583 at := a.Complex64s() 5584 bt := b.Complex64s() 5585 rt := recv.Complex64s() 5586 DivRecvC64(at, bt, rt) 5587 return 5588 case Complex128: 5589 at := a.Complex128s() 5590 bt := b.Complex128s() 5591 rt := recv.Complex128s() 5592 DivRecvC128(at, bt, rt) 5593 return 5594 default: 5595 return errors.Errorf("Unsupported type %v for DivRecv", t) 5596 } 5597 } 5598 5599 func (e E) PowRecv(t reflect.Type, a *storage.Header, b *storage.Header, recv *storage.Header) (err error) { 5600 as := isScalar(a, t) 5601 bs := isScalar(b, t) 5602 rs := isScalar(recv, t) 5603 5604 if ((as && !bs) || (bs && !as)) && rs { 5605 return errors.Errorf("Cannot increment on a scalar increment. len(a): %d, len(b) %d", a.TypedLen(t), b.TypedLen(t)) 5606 } 5607 5608 switch t { 5609 case Float32: 5610 at := a.Float32s() 5611 bt := b.Float32s() 5612 rt := recv.Float32s() 5613 PowRecvF32(at, bt, rt) 5614 return 5615 case Float64: 5616 at := a.Float64s() 5617 bt := b.Float64s() 5618 rt := recv.Float64s() 5619 PowRecvF64(at, bt, rt) 5620 return 5621 case Complex64: 5622 at := a.Complex64s() 5623 bt := b.Complex64s() 5624 rt := recv.Complex64s() 5625 PowRecvC64(at, bt, rt) 5626 return 5627 case Complex128: 5628 at := a.Complex128s() 5629 bt := b.Complex128s() 5630 rt := recv.Complex128s() 5631 PowRecvC128(at, bt, rt) 5632 return 5633 default: 5634 return errors.Errorf("Unsupported type %v for PowRecv", t) 5635 } 5636 } 5637 5638 func (e E) ModRecv(t reflect.Type, a *storage.Header, b *storage.Header, recv *storage.Header) (err error) { 5639 as := isScalar(a, t) 5640 bs := isScalar(b, t) 5641 rs := isScalar(recv, t) 5642 5643 if ((as && !bs) || (bs && !as)) && rs { 5644 return errors.Errorf("Cannot increment on a scalar increment. len(a): %d, len(b) %d", a.TypedLen(t), b.TypedLen(t)) 5645 } 5646 5647 switch t { 5648 case Int: 5649 at := a.Ints() 5650 bt := b.Ints() 5651 rt := recv.Ints() 5652 ModRecvI(at, bt, rt) 5653 return 5654 case Int8: 5655 at := a.Int8s() 5656 bt := b.Int8s() 5657 rt := recv.Int8s() 5658 ModRecvI8(at, bt, rt) 5659 return 5660 case Int16: 5661 at := a.Int16s() 5662 bt := b.Int16s() 5663 rt := recv.Int16s() 5664 ModRecvI16(at, bt, rt) 5665 return 5666 case Int32: 5667 at := a.Int32s() 5668 bt := b.Int32s() 5669 rt := recv.Int32s() 5670 ModRecvI32(at, bt, rt) 5671 return 5672 case Int64: 5673 at := a.Int64s() 5674 bt := b.Int64s() 5675 rt := recv.Int64s() 5676 ModRecvI64(at, bt, rt) 5677 return 5678 case Uint: 5679 at := a.Uints() 5680 bt := b.Uints() 5681 rt := recv.Uints() 5682 ModRecvU(at, bt, rt) 5683 return 5684 case Uint8: 5685 at := a.Uint8s() 5686 bt := b.Uint8s() 5687 rt := recv.Uint8s() 5688 ModRecvU8(at, bt, rt) 5689 return 5690 case Uint16: 5691 at := a.Uint16s() 5692 bt := b.Uint16s() 5693 rt := recv.Uint16s() 5694 ModRecvU16(at, bt, rt) 5695 return 5696 case Uint32: 5697 at := a.Uint32s() 5698 bt := b.Uint32s() 5699 rt := recv.Uint32s() 5700 ModRecvU32(at, bt, rt) 5701 return 5702 case Uint64: 5703 at := a.Uint64s() 5704 bt := b.Uint64s() 5705 rt := recv.Uint64s() 5706 ModRecvU64(at, bt, rt) 5707 return 5708 case Float32: 5709 at := a.Float32s() 5710 bt := b.Float32s() 5711 rt := recv.Float32s() 5712 ModRecvF32(at, bt, rt) 5713 return 5714 case Float64: 5715 at := a.Float64s() 5716 bt := b.Float64s() 5717 rt := recv.Float64s() 5718 ModRecvF64(at, bt, rt) 5719 return 5720 default: 5721 return errors.Errorf("Unsupported type %v for ModRecv", t) 5722 } 5723 }