Convert variable from little endian to big endian
0
votes
1
answer
2448
views
Working in Bash
I have a hex variable that I must convert from little endian to big endian
I am new to the entire concept of this and only learned about this about 20 minutes ago, so please bare with me.
My script determines a hex variable that undergoes a few changes: decimal, signed 2's complement, and division by 8.
Before everything though it must go through little endian to big endian conversion (I may be confusing the two but my example below should clarify)
EXAMPLE:
1. Hex Value: 0080
After Conversion: 8000
2. Hex Value: 9800
After Conversion: 0098
3. Hex Value: 1234
After Conversion: 3412
I believe that this is a 16 bit hex variable as it is always 4 digits.
Asked by Nir
(1 rep)
Nov 15, 2022, 07:52 PM
Last activity: Nov 15, 2022, 08:25 PM
Last activity: Nov 15, 2022, 08:25 PM