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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T01:50:33+00:00 2026-06-13T01:50:33+00:00

How can I make MSB of a binary number equal to 1 in MIPS?

  • 0

How can I make MSB of a binary number equal to 1 in MIPS? I have tried to do it with masking but I am getting error, so is there another way to do it?

The code for making MSB=1 by masking which is giving me error.

srl $s3,$s3,1

// error out of range

ori $s3,$s3,2147483648       # making MSB = 1

Regards

  • 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-13T01:50:35+00:00Added an answer on June 13, 2026 at 1:50 am

    The MIPS opcode format for instructions with immediate operands only has 16 bits available for the immediate constant.

    These 16 bits are usually taken to mean either an unsigned 16-bit value (i.e 0 to 65535, or 0x0000 – 0xFFFF in hex) for logical operations (such as ori here), or a signed 16-bit value (-32768 to 32767, or 0xFFFF8000 to 0x00007FFF) for arithmetic operations.

    So you can’t directly use 2147483648 (0x80000000) as an immediate value here – hence the “out of range” error.

    But there is an instruction for loading a 16-bit immediate value into the top 16 bits of a register (leaving the bottom bits set to 0): lui (load upper immediate).

    So, you can load 0x80000000 into a register like that, and then or it with your value:

    lui  $t0, 0x8000
    or   $t0, $t0, $s3
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I can make a translucent background , but is there a way to add
How can make a link within a facebox window that redirects it to another
I can make a single row IKImageBrowserView by setting the [imageBrowser setContentResizingMask:NSViewWidthSizable]; but in
Can someone tell me how I can make the following output? I have a
I can make a new , and that seems to work. But edit/update does
I can make the compiler give me an error (Use of variable prior to
I can make query to get the Master -Chile records. But how to display
I can make get or post request using urllib, but how do I make
Is there anyway I can make this statement smaller? for efficiency, the whole idea
i know you can make two objects equal to each other when one of

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.