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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T23:55:04+00:00 2026-05-20T23:55:04+00:00

I have seen people use addition where a bitwise OR would be more conceptually

  • 0

I have seen people use addition where a bitwise OR would be more conceptually appropriate, because they believe it is faster. Is this true? If yes, do all modern compilers know this trick?

  • 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-20T23:55:05+00:00Added an answer on May 20, 2026 at 11:55 pm

    “Conceptually appropriate” and “faster” are two different things. The former is semantics, while the latter often involves breaking semantics.

    As for the question in the title, there’s very little (if any) difference speedwise. A compiler for a CPU where this actually happens, will usually optimize it anyway — if it doesn’t cause different results, which it very well can and usually will.

    Write your code correctly — if you mean to OR, then OR. If the add-vs-OR ends up being faster, either your compiler will do it for you or you can change it later after you’ve decided whether the potential extra half-nanosecond per iteration is worth the cost in readability and the bugs such a change might cause.

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

Sidebar

Related Questions

I have seen people say that it is bad form to use catch with
I have seen this problem arise in many different circumstances and would like to
Simple question... I have seen people tell me to use \r\n in various places
I've seen people use many-to-one mappings to represent one-to-one relationships. I've also read this
I have seen people use GO statement between batches of SQL code, but AFAICS
A quick question about best practice with PHP classes. I have seen people use
I have seen some people who refuse to use Interface Builder and prefer to
I have seen a lot of discussions going on and people asking about DataGrid
I have seen some very weird for loops when reading other people's code. I
I have seen various rules for naming stored procedures. Some people prefix the sproc

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.