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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T02:12:24+00:00 2026-05-11T02:12:24+00:00

What are the underlying transformations that are necessary to convert data in a little-endian

  • 0

What are the underlying transformations that are necessary to convert data in a little-endian system into network byte order? For 2 byte and 4 byte data there are well-known functions (such as htons, ntohl, etc.) to encapsulate the changes, what happens for strings of 1 byte data (if anything)?

Also, Wikipedia implies that little-endian is the mirror image of big-endian, but if that were true why would we need specific handling for 2 and 4 byte data?

The essay ‘On Holy Wars and a Plea for Peace’ seems to imply that there are many different flavors of little-endian — it’s an old essay — does that still apply? Are byte order markers like the ones found at the beginning of Java class files still necessary?

And finally, is 4-byte alignment necessary for network-byte order?

  • 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. 2026-05-11T02:12:25+00:00Added an answer on May 11, 2026 at 2:12 am

    Let’s say you have the ASCII text ‘BigE’ in an array b of bytes.

    b[0] == 'B' b[1] == 'i' b[2] == 'g' b[3] == 'E' 

    This is network order for the string as well.

    If it was treated as a 32 bit integer, it would be

    'B' + ('i' << 8) + ('g' << 16) + ('E' << 24)  

    on a little endian platform and

    'E' + ('g' << 8) + ('i' << 16) + ('B' << 24)  

    on a big endian platform.

    If you convert each 16-bit work separately, you’d get neither of these

    'i' + ('B' << 8) + ('E' << 16) + ('g' << 24)  

    which is why ntohl and ntohs are both required.

    In other words, ntohs swaps bytes within a 16-bit short, and ntohl reverses the order of the four bytes of its 32-bit word.

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

Sidebar

Related Questions

I have an underlying asynchronous out-of-order query/response system that I want to make synchronous.
What underlying rendering system does the Qt GUI toolkit use on Windows? (I'm assuming
What is the underlying mechanism in Python that handles such aliases? >>> import os.path
We have an underlying .h file in our platform code that needs built differently
Is there anyway to extract the underlying xaml from a control. IE. I have
I am building the underlying database for a shop. There are 2 tables, one
I have a underlying API that passes a const char* and a length: foo(const
I have two methods that basically converts underlying checkboxes' text or tag as CSV
I'm looking for the underlying API calls that netstat -b is using to determine
I need to find the underlying disk capacity (total size) of an unmapped network

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.