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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T06:29:36+00:00 2026-05-17T06:29:36+00:00

Is the difference between integer multiply(temporarily forgetting about division) still in favor of shifting

  • 0

Is the difference between integer multiply(temporarily forgetting about division) still in favor of shifting and if so how big is the difference?

It simply seems such a low level optimization, even if you wanted it the shouldn’t the (C#/Java) to bytecode compiler or the jit catch it in most cases?

Note: I tested the compiled output for C#(with gmcs Mono C# compiler version 2.6.7.0) and the multiply examples didn’t use shift for multiplying even when multiplying by a multiple of 2.

C#
http://csharp.pastebin.com/hcrRnPrb

cil
http://csharp.pastebin.com/0js9F2c1

P.S.
I forgot how it might be somewhat useful to use it on bytes, but still having some trouble on using it for Numbers.

  • 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-17T06:29:37+00:00Added an answer on May 17, 2026 at 6:29 am

    You are right, if shift operators are used only as an alternative for multiplications, it should be left to the compiler.

    I suppose you overlooked applications like:

    • Encryption / decryption
    • CRC calculation
    • Bitmap manipulation (Graphics, Database locks)
    • Compression/Decompression
    • Setting up data for hardware registers
    • Change encoding

    and much more need bit-twiddling for efficient implementation without native code.

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

Sidebar

Related Questions

In C, is there a difference between integer division a/b and floor(a/b) where both
Possible Duplicate: what the difference between the float and integer data type when the
I'm trying to get a feel for the difference in performance between integer multiplication
What is the difference between these two syntaxes ? Type AnIntType = Integer; AnotherIntType
What is the difference between the following? new HashMap(); vs new HashMap<Integer, String>(); ?
I know the difference in memory usage between byte, unsigned short, and integer, but
In Haskell, what is the difference between an Int and an Integer ? Where
Possible Duplicate: Difference between different integer types What is the difference between uint32 and
I have a clarification about some Java code: What's the difference between these codes,
What is the difference between List list = new ArrayList<Integer>(); And List<Integer> list =

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.