小编use*_*367的帖子

为什么循环裂变在这种情况下有意义?

没有裂变的代码看起来像这样:

int check(int * res, char * map, int n, int * keys){
    int ret = 0;
    for(int i = 0; i < n; ++i){
        res[ret] = i;
        ret += map[hash(keys[i])]
    }
    return ret;
}
Run Code Online (Sandbox Code Playgroud)

裂变:

int check(int * res, char * map, int n, int * keys){
    int ret = 0;
    for(int i = 0; i < n; ++i){
        tmp[i] = map[hash(keys[i])];
    }
    for(int i = 0; i < n; ++i){
        res[ret] = i;
        ret += tmp[i];
    }
    return …
Run Code Online (Sandbox Code Playgroud)

c memory optimization performance

9
推荐指数
1
解决办法
989
查看次数

浮点比较精度

给定3个IEEE-754浮点数a,b,c不是+/- INF而不是NaN和a <b,可以安全地假设a - c <b - c?或者,如果这不正确,你能给出一个例子吗?

c c++ floating-point ieee-754

5
推荐指数
1
解决办法
725
查看次数

标签 统计

c ×2

c++ ×1

floating-point ×1

ieee-754 ×1

memory ×1

optimization ×1

performance ×1