diff options
author | Dean Camera <dean@fourwalledcubicle.com> | 2011-04-13 06:12:52 +0000 |
---|---|---|
committer | Dean Camera <dean@fourwalledcubicle.com> | 2011-04-13 06:12:52 +0000 |
commit | e0852408de92eada94b242cf84b007dc4f188467 (patch) | |
tree | b58ea4dab5bffecccf932422804d2e378e87b1fa /Projects/AVRISP-MKII/Lib/XPROG | |
parent | 4b1f6cac75a86874d2a15e1893cfb258b2397fb5 (diff) | |
download | lufa-e0852408de92eada94b242cf84b007dc4f188467.tar.gz lufa-e0852408de92eada94b242cf84b007dc4f188467.tar.bz2 lufa-e0852408de92eada94b242cf84b007dc4f188467.zip |
Replace cast-as-char* byte access of multibyte variables with proper shifts and masks to preserve endianness across different architectures.
Diffstat (limited to 'Projects/AVRISP-MKII/Lib/XPROG')
-rw-r--r-- | Projects/AVRISP-MKII/Lib/XPROG/TINYNVM.c | 4 | ||||
-rw-r--r-- | Projects/AVRISP-MKII/Lib/XPROG/XMEGANVM.c | 8 |
2 files changed, 6 insertions, 6 deletions
diff --git a/Projects/AVRISP-MKII/Lib/XPROG/TINYNVM.c b/Projects/AVRISP-MKII/Lib/XPROG/TINYNVM.c index 49d576608..891ae8d14 100644 --- a/Projects/AVRISP-MKII/Lib/XPROG/TINYNVM.c +++ b/Projects/AVRISP-MKII/Lib/XPROG/TINYNVM.c @@ -43,9 +43,9 @@ static void TINYNVM_SendPointerAddress(const uint16_t AbsoluteAddress) { /* Send the given 16-bit address to the target, LSB first */ XPROGTarget_SendByte(TPI_CMD_SSTPR | 0); - XPROGTarget_SendByte(((uint8_t*)&AbsoluteAddress)[0]); + XPROGTarget_SendByte(AbsoluteAddress & 0xFF); XPROGTarget_SendByte(TPI_CMD_SSTPR | 1); - XPROGTarget_SendByte(((uint8_t*)&AbsoluteAddress)[1]); + XPROGTarget_SendByte(AbsoluteAddress >> 8); } /** Sends a SIN command to the target with the specified I/O address, ready for the data byte to be written. diff --git a/Projects/AVRISP-MKII/Lib/XPROG/XMEGANVM.c b/Projects/AVRISP-MKII/Lib/XPROG/XMEGANVM.c index b1fea5992..e4f1186b0 100644 --- a/Projects/AVRISP-MKII/Lib/XPROG/XMEGANVM.c +++ b/Projects/AVRISP-MKII/Lib/XPROG/XMEGANVM.c @@ -45,10 +45,10 @@ static void XMEGANVM_SendAddress(const uint32_t AbsoluteAddress) { /* Send the given 32-bit address to the target, LSB first */ - XPROGTarget_SendByte(((uint8_t*)&AbsoluteAddress)[0]); - XPROGTarget_SendByte(((uint8_t*)&AbsoluteAddress)[1]); - XPROGTarget_SendByte(((uint8_t*)&AbsoluteAddress)[2]); - XPROGTarget_SendByte(((uint8_t*)&AbsoluteAddress)[3]); + XPROGTarget_SendByte(AbsoluteAddress & 0xFF); + XPROGTarget_SendByte(AbsoluteAddress >> 8); + XPROGTarget_SendByte(AbsoluteAddress >> 16); + XPROGTarget_SendByte(AbsoluteAddress >> 24); } /** Sends the given NVM register address to the target. |