探索gcc編譯最佳化細節 編譯器最佳化gcc -o3

dafengchui發表於2024-07-10
int n = count / 2;
for (int i = 0; i < n; ++i) {
    *to = *from++;
}
int n = (count + 7) / 8;
switch (count % 8) {
    case 0: do { *to = *from++; } while (--n > 0);
    case 7: *to = *from++;
    case 6: *to = *from++;
    case 5: *to = *from++;
    case 4: *to = *from++;
    case 3: *to = *from++;
    case 2: *to = *from++;
    case 1: *to = *from++;
} while (--n > 0);

最佳化演算法

相關文章