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 7519287
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T01:52:40+00:00 2026-05-30T01:52:40+00:00

i have a question about the branchtables. There are two ways to declare such

  • 0

i have a question about the branchtables.

There are two ways to declare such a table:

  1. in the Data Sector (DS)
  2. in the Code Sector (CS)

Whats the different between this methods?

I’ve learned it this the following examples:
Case 1:

 SECTION  .data 
 i            dd        2;
 stab         dd        m1,m2,m3 ; branchtable for switch

 SECTION  .text
 global       start
 start: 
 mov  ebx ,   [ i ]          ;       switch   ( i )  
 cmp  ebx ,   1 ;  
 jl   end 
 cmp  ebx ,   3 
 jg   end 
 shl   ebx ,   2 ;       / ∗   stab  4  Bytes   ∗ /
 jmp   [ stab+ebx −4];      
 m1: ;do something.....
 ....

Case 2:

 SECTION  .data 
 i            dd        2;

 SECTION  .text
 global       start
 start: 
 mov  ebx ,   [ i ]          ;       switch   ( i )  
 cmp  ebx ,   1 ;  
 jl   end 
 cmp  ebx ,   3 
 jg   end 
 shl   ebx ,   2 ;       / ∗   stab  4  Bytes   ∗ /
 jmp   [ cs : ebx+stab −4];  branchtable in codesegment
 ALIGN  4 ;     
 stab         dd        m1,m2,m3 
 m1: ; do something
 ....

Our prof told us, that method 2 is more effectiv but why? Because to the branchtable it’s only a short jump and we doesn’t need to show in the DS?

greetz destiny

  • 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-05-30T01:52:40+00:00Added an answer on May 30, 2026 at 1:52 am

    which method is more effective depends on the processor you are dealing with, however, I beg to differ with your prof, using CS requires a segment prefix override, making the code bigger, thus longer to process and less cache friendly. but on x86 windows (userland), CS and DS flatten out to the same linear address space, making it a moot optimization.

    Certain processors (Intel Atom) also have slower access to CS when the segment base is non-zero, though under x64 this falls away as all segments apart from FS and GS are ignored (their base is implicity 0), due to x64’s flat addressing model.
    It should also be noted that Intel advises the use of as few segment registers as possible (this ease the burden on the register renamer).

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

Sidebar

Related Questions

i have question about two different Bundle object in below methods : onSaveInstanceState(Bundle outState);
I have a question about inserting column stored procedure into table. I have two
I have question about interpreting strings as packed binary data in C++. In python,
i have question about YAJLiOS parser... I have next json data : {{ body
I have question about database optimizing, indexing. I have table that called projects and
I have question about my code which does the Hoare Partition Method. Here is
I have a question about best practices with the Module Design Pattern. The code
I have question about throw. How will the throw work in the following code?
I have a question about timer in thread? My code : public partial class
I have a question about a string in C++. As per below code, I

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.