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

  • Home
  • SEARCH
  • 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 6949115
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T13:54:44+00:00 2026-05-27T13:54:44+00:00

I tried to solve a question shown below; By just using and, and jg

  • 0

I tried to solve a question shown below;

By just using and, and jg or jle, how can one implement following code?

    if %eax > 4 
        jmp do
    else 
        jmp l1

of course without changing value of eax

This question is taken from a textbook, but it has no answer. Can you show me how to solve it?

EDIT:
I have tried ;

     subl $4, %eax
     andl %eax, %eax
     jg  do
     jmp l1
      .
      .
      .
     do :
     addl $4, %eax
      .
      .
      .
     l1:
     addl $4, %eax
  • 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-27T13:54:45+00:00Added an answer on May 27, 2026 at 1:54 pm

    The below sequence of and and jle solves the problem (NASM syntax is used):

    ; start execution here if eax is treated as an unsigned integer
    unsigned_eax:
        and     dword [eighty - 3], eax
        and     dword [eighty], 80H
        jle     signed_eax ; jumps if eax <= 7FFFFFFFh, continues otherwise
        and     dword [eighty], 0
        jle     do ; jumps if eax > 7FFFFFFFh = always
    
    ; start execution here if eax is treated as a signed integer
    signed_eax:
        and     dword [FFFFFFFC], eax
        jle     l1 ; jumps if eax < 4, continues if eax >= 4
        and     dword [FFFFFFFB], eax
        jle     l1 ; jumps if eax = 4, continues if eax > 4
        and     dword [zero], 0 ; this and the next instruction simulate "jmp do"
        jle     do
    do:
        ; some code
    l1:
        ; some code
    
    FFFFFFFC    dd 0FFFFFFFCH
    FFFFFFFB    dd 0FFFFFFFBH
    zero        dd 0
    eighty      dd 80H
    

    The caveat here is that this is a use-once piece of code because it irreversibly modifies 2 (or 3) variables.

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

Sidebar

Related Questions

I have a question in Django on how you can compare dates to solve
Loading the image one time works as done in the following steps (for code
The Background: I tried to solve the StackOverflow question yet another HTML/CSS layout challenge
I tried to solve problems from Project Euler. I know my method would work
I'm learning functional programming, and have tried to solve a couple problems in a
Tried following the instructions here: How to use Google app engine with my own
Tried a bunch of things but I can't get it to work consistently amid
Can someone help me please. I had replies to a similar question but am
In my application I'm using a Navigation Controller to push one view that loads
Please bear with me as I explain the problem, how I tried to solve

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.