mirror of
https://github.com/Atmosphere-NX/Atmosphere.git
synced 2024-11-22 20:06:40 +00:00
Use memcpy instead of raw casts in sdmmc.c
This commit is contained in:
parent
b4eeddd7e1
commit
2bc2fe1452
1 changed files with 2 additions and 5 deletions
|
@ -1274,7 +1274,7 @@ static int sdmmc_handle_cpu_transfer(struct mmc *mmc, uint16_t blocks, bool is_w
|
||||||
// Handle unaligned buffers
|
// Handle unaligned buffers
|
||||||
uint32_t w;
|
uint32_t w;
|
||||||
uint8_t *data = (uint8_t *)buffer;
|
uint8_t *data = (uint8_t *)buffer;
|
||||||
w = data[0] | (data[1] << 8) | (data[2] << 16) | (data[3] << 24);
|
memcpy(&w, data, 4);
|
||||||
mmc->regs->buffer = w;
|
mmc->regs->buffer = w;
|
||||||
} else {
|
} else {
|
||||||
mmc->regs->buffer = *buffer;
|
mmc->regs->buffer = *buffer;
|
||||||
|
@ -1284,10 +1284,7 @@ static int sdmmc_handle_cpu_transfer(struct mmc *mmc, uint16_t blocks, bool is_w
|
||||||
// Handle unaligned buffers
|
// Handle unaligned buffers
|
||||||
uint32_t w = mmc->regs->buffer;
|
uint32_t w = mmc->regs->buffer;
|
||||||
uint8_t *data = (uint8_t *)buffer;
|
uint8_t *data = (uint8_t *)buffer;
|
||||||
data[0] = w & 0xFF;
|
memcpy(&w, data, 4);
|
||||||
data[1] = (w >> 8) & 0xFF;
|
|
||||||
data[2] = (w >> 16) & 0xFF;
|
|
||||||
data[3] = (w >> 24) & 0xFF;
|
|
||||||
} else {
|
} else {
|
||||||
*buffer = mmc->regs->buffer;
|
*buffer = mmc->regs->buffer;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue