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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T06:28:37+00:00 2026-06-14T06:28:37+00:00

For bit-wise shift (or rotation, circulation) operations, we usually have an operator , i

  • 0

For bit-wise shift (or rotation, circulation) operations, we usually have an operator, i mean two of them, for instance

x << n
x >> n

for left or right shift of x by n bits.

We want to define a single function

bitshift(x, n)

Before that, we have to determine, which shift is to be used for positive and negative n – what is the "sign" of each shift (or rotation) direction.

Is there a definition or convention for that?

(Please note that this question has nothing to do with signed/unsigned types)

UPDATES

Please also note that i am not asking for implementation details of this function, even it might be somewhat related..

There are similar functions in scheme/lisp-like languages, like ash, which do left shift for positive n

  • 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-14T06:28:39+00:00Added an answer on June 14, 2026 at 6:28 am

    Since shifting right by k places is equal to multiplying by 2^-k, and shifting left is equal to multiplying by 2^k, I think that should give you a hint.

    Note: Reason I would argue for this way of looking at it is that it is common to consider multiplication as more fundamental operation in some sense than division is, although you could certainly argue the other way around.

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

Sidebar

Related Questions

How do I bitwise shift right/left in VB.NET? Does it even have operators for
I have learned how to work with 80x86 assembler, so in bit-wise shift operation,
Based on the following simple program the bitwise left shift operator works only for
I need to perform a circular left shift of a 64-bit integer in JavaScript.
I want to compare two multiplication methods implemented in Java which use shift operations
I'm using LEFT SHIFT operator from java to generate some unique number and validate
As far as I know when you use a left shift bitwise operator in
I need to perform a bitwise left shift on a 16-bit integer (ushort /
I was looking at F# doc on bitwise ops: Bitwise right-shift operator . The
I have got an array of chars that I'm trying to bitwise shift right

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.