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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T03:38:59+00:00 2026-06-01T03:38:59+00:00

// input, output, i, and k are uint16_t type // It is assured that

  • 0
// input, output, i, and k are uint16_t type
// It is assured that k is non-negative and "small enough"
// k = 4
// input = 0x3a44
output = 0;
for (i=k; i<16; i++){
if (input & 1<<i)
output = output | 1 <<(i-k);
}

so input = 0011 1010 0100 0100
with k = 4 or 0000 0000 0000 0100 the loop runs 12 times

I guess what is confusing me is how the if and output parts are working, I know the bitwise operators & and | and that left shift is <<..but I get lost with what the overall function of the loop is

  • 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-01T03:39:01+00:00Added an answer on June 1, 2026 at 3:39 am

    It’s apparently intended to make the output equal to (16 bits of) the input, right-shifted 4 bits (or whatever the value assigned to K happens to be).

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

Sidebar

Related Questions

I have a perl program that takes input and output file arguments, and I'd
Is there a mature library that could enable audio input and output and work
The title is pretty explicit and below are couple of samples input/output. Note that
As far as I understand it, applications that want input/output functionalities must speak to
I'm creating an app that has to input/output data from a specific web server
We all know that App Engine limits you to 1 MB for most input/output
I am doing some input/output between a c++ and a python program (only floating
Just out of curiosity, how does iostream access the input-output system. (I have a
I am a beginner in UNIX. I am finding some difficulty in input/output redirection.
See updated input and output data at Edit-1. What I am trying to accomplish

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.