- void combine2(vec_ptr v, data_t* dest)
- {
- long int i;
- long int length = vec_lenght(v);
- *dest = IDENT;
- for (i = 0; i < length; ++i)
- {
- data_t val;
- get_vec_element(v, i, &val);
- *dest = *dest OP val;
- }
- }
- //下例
- void lower1(char* s)
- {
- int i;
- for (i = 0; i < strlen(s); ++i)
- {
- if (s[i] >= 'A' && s[i] <= 'Z')
- {
- s[i] -= ('A' - 'a');
- }
- }
- }
- void lower2(char* s)
- {
- int i;
- int len = strlen(s);
- for (i = 0; i < len; ++i)
- {
- if (s[i] > = 'A' && s[i] <= 'Z')
- {
- s[i] -= ('A' - 'a');
- }
- }
- }
- size_t strlen(const char* s)
- {
- int length = 0;
- while (*s != '\0')
- {
- ++s;
- ++length;
- }
- return length;
- }
Eliminating Loop Inefficiencies
最新推荐文章于 2023-12-05 18:22:00 发布