A Universal Data Format

Data types larger than the size of a byte aren’t portable because of the different endian-ordering of each hardware architecture. This means that passing an int in its binary form from an Intel-based machine to a Unix machine or vice versa requires that you reverse the integer’s byte before the target machine can read it. Sometimes, reversing the byte ordering is either too expensive in terms of performance or it’s simply too complicated. Worse yet, there are several ordering options: little endian, big endian, middle endian and so on. It’s not always possible to predict the exact byte ordering of the target machine in advance. Is there a workaround? Yes, there is. Pass all data variables in their textual representation. For example, instead of passing the integer 0 as a sequence of 4 bytes, pass the string “0”. Another example: instead of passing the integer 32 as a sequence of the bytes 0x0, 0x0, 0x0, 0x20, pass the literal string “32” instead. Char arrays are portable and they do not require order reversing.

Share the Post:
Share on facebook
Share on twitter
Share on linkedin


The Latest

homes in the real estate industry

Exploring the Latest Tech Trends Impacting the Real Estate Industry

The real estate industry is changing thanks to the newest technological advancements. These new developments — from blockchain and AI to virtual reality and 3D printing — are poised to change how we buy and sell homes. Real estate brokers, buyers, sellers, wholesale real estate professionals, fix and flippers, and beyond may

man on floor with data

DevX Quick Guide to Data Ingestion

One of the biggest trends of the 21st century is the massive surge in internet usage. With major innovations such as smart technology, social media, and online shopping sites, the internet has become an essential part of everyday life for a large portion of the population. Due to this internet

payment via phone

7 Ways Technology Has Changed Traditional Payments

In today’s digital world, technology has changed how we make payments. From contactless cards to mobile wallets, it’s now easier to pay for goods and services without carrying cash or using a checkbook. This article will look at seven of the most significant ways technology has transformed traditional payment methods.