diff options
author | Max Kellermann <max@duempel.org> | 2013-10-16 21:12:11 +0200 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2013-10-16 22:07:59 +0200 |
commit | 08eca827b659f2becc872c151919948b5a9ffe4d (patch) | |
tree | 5e67d3d881627967aaa434bdbba6c71be1c6c423 /src/util/ByteReverse.cxx | |
parent | 6b2b5af3440d8bd5c6ca6bde934610925d652e88 (diff) |
util/ByteReverse: use C99 "restrict"
Micro-optimization.
Diffstat (limited to 'src/util/ByteReverse.cxx')
-rw-r--r-- | src/util/ByteReverse.cxx | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/src/util/ByteReverse.cxx b/src/util/ByteReverse.cxx index e5367b34c..d1d0a935a 100644 --- a/src/util/ByteReverse.cxx +++ b/src/util/ByteReverse.cxx @@ -18,12 +18,14 @@ */ #include "ByteReverse.hxx" +#include "Compiler.h" #include <glib.h> #include <assert.h> void -reverse_bytes_16(uint16_t *dest, const uint16_t *src, const uint16_t *src_end) +reverse_bytes_16(uint16_t *gcc_restrict dest, + const uint16_t *gcc_restrict src, const uint16_t *src_end) { assert(dest != nullptr); assert(src != nullptr); @@ -36,7 +38,8 @@ reverse_bytes_16(uint16_t *dest, const uint16_t *src, const uint16_t *src_end) } void -reverse_bytes_32(uint32_t *dest, const uint32_t *src, const uint32_t *src_end) +reverse_bytes_32(uint32_t *gcc_restrict dest, + const uint32_t *gcc_restrict src, const uint32_t *src_end) { assert(dest != nullptr); assert(src != nullptr); @@ -49,7 +52,8 @@ reverse_bytes_32(uint32_t *dest, const uint32_t *src, const uint32_t *src_end) } void -reverse_bytes_64(uint64_t *dest, const uint64_t *src, const uint64_t *src_end) +reverse_bytes_64(uint64_t *gcc_restrict dest, + const uint64_t *gcc_restrict src, const uint64_t *src_end) { assert(dest != nullptr); assert(src != nullptr); @@ -62,7 +66,8 @@ reverse_bytes_64(uint64_t *dest, const uint64_t *src, const uint64_t *src_end) } static void -reverse_bytes_linear(uint8_t *dest, const uint8_t *src, size_t n) +reverse_bytes_linear(uint8_t *gcc_restrict dest, + const uint8_t *gcc_restrict src, size_t n) { src += n; @@ -71,8 +76,8 @@ reverse_bytes_linear(uint8_t *dest, const uint8_t *src, size_t n) } static void -reverse_bytes_generic(uint8_t *dest, - const uint8_t *src, const uint8_t *src_end, +reverse_bytes_generic(uint8_t *gcc_restrict dest, + const uint8_t *gcc_restrict src, const uint8_t *src_end, size_t frame_size) { assert(dest != nullptr); @@ -89,7 +94,8 @@ reverse_bytes_generic(uint8_t *dest, } void -reverse_bytes(uint8_t *dest, const uint8_t *src, const uint8_t *src_end, +reverse_bytes(uint8_t *gcc_restrict dest, + const uint8_t *gcc_restrict src, const uint8_t *src_end, size_t frame_size) { assert(dest != nullptr); |