Path: utzoo!utgpu!attcan!uunet!lll-winken!lll-tis!helios.ee.lbl.gov!pasteur!ames!nrl-cmf!mailrus!cornell!uw-beaver!uw-june!pardo From: pardo@june.cs.washington.edu (David Keppel) Newsgroups: comp.lang.misc Subject: Re: Row/Column Major Definition and History? Keywords: arrays, row major, column major, history, definition Message-ID: <5632@june.cs.washington.edu> Date: 2 Sep 88 18:41:39 GMT References: <16512@apple.Apple.COM> Reply-To: pardo@uw-june.UUCP (David Keppel) Organization: U of Washington, Computer Science, Seattle Lines: 37 malcolm@Apple.COM (Malcolm Slaney) writes: >[ Arrays: row- and column-major. Whuzzat? ] Reference: _The Theory and Practice of Compiler Writing_ by Jean-Paul Tremblay and Paul G. Sorenson. McGraw-Hill, 1985. pg 574. Idea: Memory is just a 1-dimensional array. If we want a 2-d array, we need to make a map from the 2-d "name" (e.g., A[2,3]) to the actual 1-d location. Row- and column-major are just slighly different ways of doing the mapping. Consider: A[4..6,2..3] of two-byte It can be laid out starting at addres 1010 as: 1010 <4,2> 1012 <4,3> 1014 <5,2> 1016 <5,3> 1018 <6,2> 1020 <6,3> or as 1010 <4,2> 1012 <5,2> 1014 <6,2> 1016 <4,3> 1018 <5,3> 1020 <6,3> ;-D on ( Help! my my commanding officer is row-major! ) Pardo -- pardo@cs.washington.edu {rutgers,cornell,ucsd,ubc-cs,tektronix}!uw-beaver!june!pardo