Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8301725
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T17:07:01+00:00 2026-06-08T17:07:01+00:00

I have a 3D array and I want to deal with the value of

  • 0

I have a 3D array and I want to deal with the value of say c[l][i][k]..

  • c is in the location 16(%ebp)
  • l is in -24(%ebp)
  • i is in -20(%ebp)
  • k is in -12(%ebp)

The array size is [20][20][20]

The assembly code for this is

movl    -24(%ebp), %eax          #eax <-- l
imull   $1600, %eax, %eax        #eax <--1600*l 
movl    %eax, %ecx               #ecx <--1600*l
addl    16(%ebp), %ecx           #ecx <--1600*l + c 
movl    -20(%ebp), %edx          #edx <-- i
movl    %edx, %eax               #eax <-- i
sall    $2, %eax                
addl    %edx, %eax              
sall    $2, %eax            
addl    -12(%ebp), %eax             
movl    -8(%ebp), %edx              
movl    %edx, (%ecx,%eax,4)
  1. what is the significance of each of the assembly code lines here?
  2. How do we actually get the value c[l][i][k]?
  3. Also what is the line movl %edx, (%ecx,%eax,4) doing?
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T17:07:02+00:00Added an answer on June 8, 2026 at 5:07 pm

    That array is represented as a contiguous sequence of 20 * 20 * 20 * (size of one element) bytes. The address of element [l][i][k] inside this array can be computed as follows:

       l * 20 * 20 * size of one element
     + i * 20 * size of one element
     + k * size of one element
    

    The multiplication 1600 * l does the first step – l * 20 * 20 * (size of one element) bytes (which suggests that size is 4 bytes).

    The lines you haven’t commented compute (((i << 2) + i) << 2) + k , which is essentially 20 * i + k – the second and third steps combined, sans the multiplication by element size. (sall is “shift left”, same as C’s bitwise shift.)

    This missing multiplication is done by the last line: movl %edx (%ecx, %eax, 4) computes ecx + eax * 4 (the address we want) and puts the value of edx into that address.

    Note that this code appears to be writing into the array, not reading from it, like your question suggests. To read that element from the array, you should use that parenthesized expression as the first argument of movl.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Say I have a 3D array, A(1:3,1:4,1:5) , and I only want to deal
i have an array and i want to convert this array in comma seprated
I have to array and I want to merge this two array with a
I have an array that I want to sort based on the value of
I have an array where I want to get the next value. $sorting =
I have one array. I want that array to retain its value between function
I have a DataTable, say pdt, in my code. I just want to select
I have an array I want to check the the last digits if it
I have an array of strings: @array I want to concatenate all strings beginning
I have an array which I want to use in a query: Array (

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.