Reverse Bytes - Big Endian Little Endian conversion - Bit Manipulation Firmware Interview

Опубликовано: 18 Октябрь 2024
на канале: Firmware
5,127
86

Here we learn how to reverse bytes of a number to convert from Big Endian to Little Endian or vice-versa. This is a common interview question for software/firmware/embedded roles that tests your concepts of Masking, Shifting, and Bit Manipulations.
In the previous episode, we saw that the ordering of bytes of a stored number in memory is the exact opposite between a little-endian machine and a big-endian machine. Therefore if we want to convert big-endian to little-endian or vice-versa, we just need to reverse the position of bytes in the number. The left-most byte in the input would become the rightmost byte in the output, and the rightmost byte in the input would become the left-most byte in the output.

See Big Endian Little Endian Concept here:    • How to check Big Endian and Little En...  

See Byte Alignment Concept here:    • Byte Alignment, Word alignment in Mem...  

See Bit Manipulation Interview Preparation Series here:
   • Bit Manipulation Interview Series  

You could follow us on Facebook and Instagram:
Facebook :   / firmwarecode  
Instagram :   / firmwarecode  

#bitmanipulation #bitalgorithm