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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T19:56:55+00:00 2026-06-02T19:56:55+00:00

I found the following in some old and bad documented C code: #define addr

  • 0

I found the following in some old and bad documented C code:

#define addr (((((147 << 8) | 87) << 8) | 117) << 8) | 107

What is it? Well I know it’s an IP address – and shifting 8 bits to the left makes some sense too. But can anyone explain this to me as a whole? What is happening there?

Thank you!

  • 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-02T19:56:59+00:00Added an answer on June 2, 2026 at 7:56 pm

    The code

    (((((147 << 8) | 87) << 8) | 117) << 8) | 107
    

    generates 4 bytes containing the IP 147.87.117.107.
    The first step is the innermost bracket:

    147<<8
    147 = 1001 0011
    1001 0011 << 8 = 1001 0011 0000 0000
    

    The second byte 87 is inserted by bitwise-or operation on (147<<8). As you can see, the 8 bits on the right are all 0 (due to <<8), so the bitwise-or operation just inserts the 8 bits from 87:

    1001 0011 0000 0000  (147<<8)
    0000 0000 0101 0111  (87)
    -------------------  bitwise-or
    1001 0011 0101 0111  (147<<8)|87
    

    The same is done with rest so you have 4 bytes at the end saved into a single 32-bit integer.

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

Sidebar

Related Questions

I'm going through some old code and found the following: public class MyClass implements
I was just reviewing some old code and found the following (inside foo.asp): Const
I was looking into some old code in my product and i found following
I'm maintaining some code and have found the following pattern a lot: var isMale
Reviewing a quite old project I found the following curious code snippet (only relevant
I've found recently that for some types of financial calculations that the following pattern
I found the following code somewhere, but I am not understanding the code properly.
I found the following code in my team's project: Public Shared Function isRemoteDisconnectMessage(ByRef m
I have been doing some tests (to replace old code) with the __invoke magic
I am updating some old code and I have a subclassed UIView (GraphView) that

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.