Skip to content

Commit

Permalink
Replace pointer casting with memcpy to avoid unaligned access, and ad…
Browse files Browse the repository at this point in the history
…d endian support.

Some systems which as AVR32 requires variables greater than 8bit to be aligned to
16 bit boundaries. If you cast a memory location which is not on an even 16 bit
address to a pointer-to-integer, accessing that variable will cause invalid memory
access.

When it comes to the endian, only a select few platforms are affected. Performance
wise the compiler is pretty good at detecting what's going on and will replace the
shift operations with one instruction if available.
  • Loading branch information
denravonska committed Dec 21, 2016
1 parent 8512745 commit 6c457a9
Showing 1 changed file with 149 additions and 157 deletions.
Loading

0 comments on commit 6c457a9

Please sign in to comment.