mirror of
https://github.com/halleysfifthinc/AVCLAN-Mockingboard.git
synced 2026-08-23 22:12:54 +00:00
Use more readable byte access patterns (compiles the same)
This commit is contained in:
+6
-6
@@ -96,20 +96,20 @@ void RS232_PrintHex8(uint8_t Data) {
|
||||
}
|
||||
|
||||
void RS232_PrintHex12(uint16_t x) {
|
||||
RS232_PrintHex4(*(((uint8_t *)&x) + 1));
|
||||
RS232_PrintHex8(*(((uint8_t *)&x) + 0));
|
||||
RS232_PrintHex4((uint8_t)(x >> 8));
|
||||
RS232_PrintHex8((uint8_t)x);
|
||||
}
|
||||
|
||||
void RS232_PrintHex(uint16_t x) {
|
||||
if (x > 0x0fff) {
|
||||
RS232_PrintHex8(*(((uint8_t *)&x) + 1));
|
||||
RS232_PrintHex8((uint8_t)(x >> 8));
|
||||
} else if (x > 0xff) {
|
||||
RS232_PrintHex4(*(((uint8_t *)&x) + 1));
|
||||
RS232_PrintHex4((uint8_t)(x >> 8));
|
||||
}
|
||||
if (x > 0x0f) {
|
||||
RS232_PrintHex8(*(((uint8_t *)&x) + 0));
|
||||
RS232_PrintHex8((uint8_t)x);
|
||||
} else {
|
||||
RS232_PrintHex4(*(((uint8_t *)&x) + 0));
|
||||
RS232_PrintHex4((uint8_t)x);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user