utils/bits.h: Refactor the load/store macros.
authorMark Wooding <mdw@distorted.org.uk>
Sat, 26 May 2018 15:22:39 +0000 (16:22 +0100)
committerMark Wooding <mdw@distorted.org.uk>
Sat, 26 May 2018 17:27:30 +0000 (18:27 +0100)
commit897c58ad7408d8001e63fcc2ca8e598c9811a539
treed68b125707852576b886a800101409e666db7864
parenta9779382d1ac2404d10ebdb340a77da6a4436f12
utils/bits.h: Refactor the load/store macros.

  * Each macro is now only defined conditionally.  This allows earlier
    parts of the header file to define a compiler-specific
    implementation, with the generic definitions filling in the blanks.

  * Instead of writing the byte manipulations out longhand, build each
    one out of smaller pieces.  This has two benefits: firstly, the new
    definitions are smaller and easier to understand; and, secondly, if
    there's a compiler-specific trick for, say 16-bit loads, then 32-bit
    loads can win some of the benefit.
utils/bits.h