diff options
author | Hans Kristian Rosbach <hk-git@circlestorm.org> | 2017-02-23 09:04:48 +0100 |
---|---|---|
committer | Hans Kristian Rosbach <hk-git@circlestorm.org> | 2017-02-23 09:04:48 +0100 |
commit | 47c616ce343c47b406e20ce6ae7cf644c3e8f6cf (patch) | |
tree | d1ac1265b39a9c253c9d71a20f3b84f7340eb63c /deflate.h | |
parent | eea078bd3b14eb1546c464c4798ace5f7adfb934 (diff) |
Let all platforms defining UNALIGNED_OK use the optimized put_short
implementation. Also change from pre-increment to post-increment to
prevent a double-store on non-x86 platforms.
Diffstat (limited to 'deflate.h')
-rw-r--r-- | deflate.h | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -307,7 +307,7 @@ typedef enum { * Output a short LSB first on the stream. * IN assertion: there is enough room in pendingBuf. */ -#if defined(__x86_64) || defined(__i386_) +#ifdef UNALIGNED_OK /* Compared to the else-clause's implementation, there are few advantages: * - s->pending is loaded only once (else-clause's implementation needs to * load s->pending twice due to the alias between s->pending and @@ -318,8 +318,8 @@ typedef enum { * cost of penalty of potentially unaligned access. */ #define put_short(s, w) { \ + *(uint16_t*)(&s->pending_buf[s->pending]) = (w) ; \ s->pending += 2; \ - *(uint16_t*)(&s->pending_buf[s->pending - 2]) = (w) ; \ } #else #define put_short(s, w) { \ |