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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T19:27:07+00:00 2026-05-10T19:27:07+00:00

I have signed numbers (2s complement) stored in 32-bit integers, and I want to

  • 0

I have signed numbers (2s complement) stored in 32-bit integers, and I want to extract 16-bit fields from them. Is it true that if I extract the low 16 bits from a 32-bit signed number, the result will be correct as long as the original (32-bit) number fits into 16 bits ?

For positive numbers it is trivially true, and it seems that for negatives as well. But can it be proven ?

Thanks in advance

  • 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. 2026-05-10T19:27:08+00:00Added an answer on May 10, 2026 at 7:27 pm

    Yes, in two’s complement the sign bits extend ‘all the way’ to the left. When you cast a signed short to a signed int then the number is ‘sign extended’ and has the same value.

    Example: Nibble(-2) = 1110 => Byte(-2) = 1111_1110

    Obviously the opposite it true too, if you capture at least one sign bit then the value of the number remains unchanged.

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

Sidebar

Related Questions

I have a signed class library that I want to create assemblies for via
I want to subtract two signed 8bit integers in JavaScript. As JavaScript doesn't have
I have my signed assemblies here, in one of them I have a picture
Note that when I say client, I mean businesses or organizations that have signed
Problem I need to create 32 Bit numbers (signed or unsigned doesn't matter, the
I have a slider that let's me dynamically add a number of EditText fields.
I have a binary file which is simple a list of signed 32 bit
I have the following signed integers: (4bits)a = 6; (4bits)b = 7; (4bits)c; c
I have a bunch of numbers represented as hexadecimal strings in log files that
Does anyone have code to compare two version numbers in JavaScript? I just want

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.