mirror of
https://gitlab.com/xCrystal/pokecrystal-board.git
synced 2024-11-16 11:27:33 -08:00
parent
dc121712fe
commit
8c77d6b6d3
@ -70,8 +70,8 @@ void mingle_2bpp_planes(uint8_t *bpp_data, long size) {
|
|||||||
for (long i = 0; i < size; i += 2) {
|
for (long i = 0; i < size; i += 2) {
|
||||||
// Interleave aka "mingle" bits
|
// Interleave aka "mingle" bits
|
||||||
// <https://graphics.stanford.edu/~seander/bithacks.html#Interleave64bitOps>
|
// <https://graphics.stanford.edu/~seander/bithacks.html#Interleave64bitOps>
|
||||||
#define EXPAND_PLANE(b) (((b) * 0x0101010101010101ULL & 0x8040201008040201ULL) * 0x0102040810204081ULL)
|
#define EXPAND_PLANE(b) (((((b) * 0x0101010101010101ULL & 0x8040201008040201ULL) * 0x0102040810204081ULL) >> 48) & 0xAAAA)
|
||||||
uint16_t r = ((EXPAND_PLANE(bpp_data[i]) >> 49) & 0x5555) | ((EXPAND_PLANE(bpp_data[i + 1]) >> 48) & 0xAAAA);
|
uint16_t r = (EXPAND_PLANE(bpp_data[i]) >> 1) | EXPAND_PLANE(bpp_data[i + 1]);
|
||||||
bpp_data[i] = r >> 8;
|
bpp_data[i] = r >> 8;
|
||||||
bpp_data[i + 1] = r & 0xff;
|
bpp_data[i + 1] = r & 0xff;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user