全部书籍

专业

应用 关于 Coach 登录 开始阅读

书籍暂未推出简体中文版——当前显示英文版。

Computer Science · 术语表

什么是 Row-major order?

Definition 4.5 University Computer Science — Year 1 · 第 4 章 — Pointers and Arrays

A two-dimensional array int g[h][w] is an array of hh rows, each an array of ww elements, stored one row after the other: this is row-major order. Element g[i][j] is element i⋅w+ji \cdot w + j of the block of h⋅wh \cdot w elements.

The array g[3][4] of , as written in the source and as stored. The shade marks the row. Walking a row is a stride of 1 in memory; walking a column, a stride of 4.
The array g[3][4] of Listing 4.7, as written in the source and as stored. The shade marks the row. Walking a row is a stride of 1 in memory; walking a column, a stride of 4.
在原文中阅读 →