Implementing a Lookup Table

后端 未结 3 985
执念已碎
执念已碎 2021-01-07 10:43

I am working on a custom data structure and I am currently in the beta testing process: The data will be stored within an array and this array can be represented as a 4D, 2D

3条回答
  •  一整个雨季
    2021-01-07 10:49

    For example, like this:

    for (int i = 0; i < 256; ++i) {
        int cube = i / 64;
        int slice = (i % 64) / 16;
        int row = (i % 16) / 4;
        int col = i % 4;
        m_cr[i].A = cube / 2 * 8 + slice / 2 * 4 + row;
        m_cr[i].B = cube % 2 * 8 + slice % 2 * 4 + col;
    }
    

提交回复
热议问题