2-dimensional DW array access without MULs?
- From: "Jim Leonard" <spamtrap@xxxxxxxxxx>
- Date: 20 Mar 2006 10:47:12 -0800
I'm still trying to teach myself, so forgive me for getting something
wrong... I'm trying to optimize something for 8088 that is fairly MUL
heavy, and I thought a good way to do that was, for one particular
operation, precalculate a table and then just do (x,y) lookups into the
table. Only problem is, I can't figure out to do this without a MUL to
get to the right row/column in the array.
The only thing I can think of is to make my word array's column size
aligned by a power of 2 so that I can use shifts to get to the right
(x,y)... Or, if my word array is 128 columns or less I could use
something like "mov bh,y; shl bh,1; mov bl,x, mov result,[offset
myarray+bx]"... Is this the right line of thinking?
I'm just curious how people usually work with 2-dimensional arrays that
are not byte arrays, or have dimensions not aligned to a power of 2, or
over 64K, preferably with examples... Is LEA usually used for this? I
checked a few resouces but most of them list the different addressing
modes but not provide example usage (although I confess I haven't
checked Hyde's book yet).
Thanks in advance for any advice!
.
- Follow-Ups:
- Re: 2-dimensional DW array access without MULs?
- From: randyhyde@xxxxxxxxxxxxx
- Re: 2-dimensional DW array access without MULs?
- From: robertwessel2@xxxxxxxxx
- Re: 2-dimensional DW array access without MULs?
- Prev by Date: newbie questiom about %rip in x86-64 and var
- Next by Date: Re: LSS and MOV SS
- Previous by thread: newbie questiom about %rip in x86-64 and var
- Next by thread: Re: 2-dimensional DW array access without MULs?
- Index(es):
Relevant Pages
|