Changeset 1842 in kBuild for trunk/src/kmk
- Timestamp:
- Oct 11, 2008 8:53:51 PM (16 years ago)
- Location:
- trunk/src/kmk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kmk/make.h
r1840 r1842 178 178 # define MY_PREDICT_TRUE(expr) (expr) 179 179 # define MY_PREDICT_FALSE(expr) (expr) 180 # endif 181 #endif 182 183 #ifdef KMK 184 # include <ctype.h> 185 # if 1 /* See if this speeds things up (Windows is doing this anyway, so, 186 we might as well try be consistent in speed + features). */ 187 # if 1 188 # define MY_IS_BLANK(ch) ((ch) == ' ' || (ch) == '\t') 189 # define MY_IS_BLANK_OR_EOS(ch) ((ch) == ' ' || (ch) == '\t' || (ch) == '\0') 190 # else 191 # define MY_IS_BLANK(ch) (((ch) == ' ') | ((ch) == '\t')) 192 # define MY_IS_BLANK_OR_EOS(ch) (((ch) == ' ') | ((ch) == '\t') | ((ch) == '\0')) 193 # endif 194 # undef isblank 195 # define isblank(ch) MY_IS_BLANK(ch) 196 # else 197 # define MY_IS_BLANK(ch) isblank ((unsigned char)(ch)) 198 # define MY_IS_BLANK_OR_EOS(ch) (isblank ((unsigned char)(ch)) || (ch) == '\0') 180 199 # endif 181 200 #endif -
trunk/src/kmk/misc.c
r1841 r1842 502 502 503 503 ch0 = *s; 504 if (MY_PREDICT_FALSE( isblank(ch0) || ch0 == '\0'))504 if (MY_PREDICT_FALSE(MY_IS_BLANK_OR_EOS(ch0))) 505 505 return (char *)s; 506 506 ch1 = s[1]; 507 if (MY_PREDICT_FALSE( isblank(ch1) || ch1 == '\0'))507 if (MY_PREDICT_FALSE(MY_IS_BLANK_OR_EOS(ch1))) 508 508 return (char *)s + 1; 509 509 ch2 = s[2]; 510 if (MY_PREDICT_FALSE( isblank(ch2) || ch2 == '\0'))510 if (MY_PREDICT_FALSE(MY_IS_BLANK_OR_EOS(ch2))) 511 511 return (char *)s + 2; 512 512 ch3 = s[3]; 513 if (MY_PREDICT_FALSE( isblank(ch3) || ch3 == '\0'))513 if (MY_PREDICT_FALSE(MY_IS_BLANK_OR_EOS(ch3))) 514 514 return (char *)s + 3; 515 515 … … 565 565 566 566 ch0 = *s; 567 if (MY_PREDICT_FALSE(! isblank(ch0)))567 if (MY_PREDICT_FALSE(!MY_IS_BLANK(ch0))) 568 568 return (char *)s; 569 569 ch1 = s[1]; 570 if (MY_PREDICT_ FALSE(!isblank(ch1)))570 if (MY_PREDICT_TRUE(!MY_IS_BLANK(ch1))) 571 571 return (char *)s + 1; 572 572 ch2 = s[2]; 573 if (MY_PREDICT_FALSE(! isblank(ch2)))573 if (MY_PREDICT_FALSE(!MY_IS_BLANK(ch2))) 574 574 return (char *)s + 2; 575 575 ch3 = s[3]; 576 if (MY_PREDICT_TRUE(! isblank(ch3)))576 if (MY_PREDICT_TRUE(!MY_IS_BLANK(ch3))) 577 577 return (char *)s + 3; 578 578 … … 599 599 600 600 /* skip blanks */ 601 for (;;) 601 # if 0 /* a moderate version */ 602 for (;; p++) 603 { 604 unsigned char ch = *p; 605 if (!MY_IS_BLANK(ch)) 606 { 607 if (!ch) 608 return NULL; 609 break; 610 } 611 } 612 613 # else /* (too) big unroll */ 614 for (;; p += 4) 602 615 { 603 616 unsigned char ch0, ch1, ch2, ch3; 604 617 605 618 ch0 = *p; 606 if (MY_PREDICT_FALSE(! isblank(ch0)))619 if (MY_PREDICT_FALSE(!MY_IS_BLANK(ch0))) 607 620 { 608 621 if (!ch0) 609 622 return NULL; 610 623 break; 611 624 } 612 625 ch1 = p[1]; 613 if (MY_PREDICT_ FALSE(!isblank(ch1)))626 if (MY_PREDICT_TRUE(!MY_IS_BLANK(ch1))) 614 627 { 615 628 if (!ch1) 616 629 return NULL; 617 630 p += 1; 618 631 break; 619 632 } 620 633 ch2 = p[2]; 621 if (MY_PREDICT_FALSE(! isblank(ch2)))634 if (MY_PREDICT_FALSE(!MY_IS_BLANK(ch2))) 622 635 { 623 636 if (!ch2) 624 637 return NULL; 625 638 p += 2; 626 639 break; 627 640 } 628 641 ch3 = p[3]; 629 if (MY_PREDICT_TRUE(! isblank(ch3)))642 if (MY_PREDICT_TRUE(!MY_IS_BLANK(ch3))) 630 643 { 631 644 if (!ch3) 632 645 return NULL; 633 646 p += 3; 634 647 break; 635 648 } 636 p += 4;637 } 649 } 650 # endif 638 651 639 652 /* skip ahead until EOS or blanks. */ 640 e = p + 1; 641 for (;;) 653 # if 0 /* a moderate version */ 654 for (e = p + 1; ; e++) 655 { 656 unsigned char ch = *e; 657 if (MY_PREDICT_FALSE(MY_IS_BLANK_OR_EOS(ch))) 658 break; 659 } 660 # else /* (too) big unroll */ 661 for (e = p + 1; ; e += 4) 642 662 { 643 663 unsigned char ch0, ch1, ch2, ch3; 644 664 645 665 ch0 = *e; 646 if (MY_PREDICT_FALSE( isblank(ch0) || ch0 == '\0'))666 if (MY_PREDICT_FALSE(MY_IS_BLANK_OR_EOS(ch0))) 647 667 break; 648 668 ch1 = e[1]; 649 if (MY_PREDICT_FALSE( isblank(ch1) || ch1 == '\0'))669 if (MY_PREDICT_FALSE(MY_IS_BLANK_OR_EOS(ch1))) 650 670 { 651 671 e += 1; … … 653 673 } 654 674 ch2 = e[2]; 655 if (MY_PREDICT_FALSE( isblank(ch2) || ch2 == '\0'))675 if (MY_PREDICT_FALSE(MY_IS_BLANK_OR_EOS(ch2))) 656 676 { 657 677 e += 2; … … 659 679 } 660 680 ch3 = e[3]; 661 if (MY_PREDICT_FALSE( isblank(ch3) || ch3 == '\0'))681 if (MY_PREDICT_FALSE(MY_IS_BLANK_OR_EOS(ch3))) 662 682 { 663 683 e += 3; 664 684 break; 665 685 } 666 e += 4; 667 } 668 686 } 687 # endif 669 688 *ptr = e; 689 670 690 if (lengthptr != 0) 671 691 *lengthptr = e - p;
Note:
See TracChangeset
for help on using the changeset viewer.