且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

将二维数组索引转换为一维索引

更新时间:2023-02-26 22:55:58

给定 4 列 x 8 行:

Given 4 columns by 8 rows then:

i = row * 4 + col

我的错,显然没有人发现我犯了这个错误.但它实际上应该是 row * 4 + col.

My bad, nobody caught me on this mistake apparently. But it should actually be row * 4 + col.

row * 8 + col 会在可能的索引中留下不必要的间隙.

row * 8 + col would leave unnecessary gaps in the possible indexes.