devxlogo

Convert “Little-Endian” to “Big-Endian”

Convert “Little-Endian” to “Big-Endian”

This tip outlines two simple methods that help you to convert a number from the “little-endian” format to the “big-endian” format.

// 2-byte numberint SHORT_little_endian_TO_big_endian(int i){    return ((i>>8)&0xff)+((i >8)+((i>>24)&0xff);}

devx-admin

Share the Post: