Contribute
Register

Can Someone Explain Hex Swapping Please?

Status
Not open for further replies.
Joined
Oct 29, 2011
Messages
955
Motherboard
GA-Z170X-UD5 TH
CPU
i7 6700K
Graphics
RX 580
Mac
  1. MacBook Air
  2. MacBook Pro
Mobile Phone
  1. iOS
I'm trying to get my Intel HD 630 graphics working under Monterey with OpenCore and want to try some different frame buffer settings. But I'm completely confused by the whole hex swapping thing. I'm sure it's probably really simple, but it's one of those things that everyone seems to assume you already know. For instance, on the dortania page, they say that the default framebuffer is 0x59160000, but they say when it's hex swapped (whatever that means) it's like this: 00001659. Which is obviously a completely different series of numbers.

So, what do they do to get from

to0x59160000
00001659
??

Any help greatly appreciated!
 
There are eight hexadecimal (base 16) digits with values 0–F, which work just like 0–9 (base 10 / decimal) but adding first six letters of alphabet A–F.

0x provides needed context that the number is hex when no letter digits are present to disambiguate.

Split the group of eight digits into two groups of four:

0x1234ABCD -> 1234 ABCD
and swap them:
ABCD 1234

Now split each group of four into groups of two

ABCD 1234 -> AB CD 12 34
and swap those subgroups
CD AB 34 12

Result: 1234ABCD -> CDAB3412

Regarding lore of hack config, there's another aspect that is maddening which is there lack of context to know whether the numbers you are seeing have already been converted or not.

When you are reading WhateverGreen FAQ or Dortania docs the authors have been careful to distinguish by putting 0x in front of raw data and leaving 0x out of converted values. Not everyone is so careful, especially when sharing config details.

Read about "little-endian vs big-endian" memory layouts for more context and history. There's quirky lore in computing history that the terms come from Gulliver's Travels.
 
Both Hackintool and OpenCore Configurator have a calculator for this. I use Hackintool

1649596601975.png


1649595415695.png


1649595449801.png
 
Last edited:
Thank you so much!
 
Status
Not open for further replies.
Back
Top