summaryrefslogtreecommitdiff
path: root/deflate.h
diff options
context:
space:
mode:
authorHans Kristian Rosbach <hk-git@circlestorm.org>2017-02-23 09:04:48 +0100
committerHans Kristian Rosbach <hk-git@circlestorm.org>2017-02-23 09:04:48 +0100
commit47c616ce343c47b406e20ce6ae7cf644c3e8f6cf (patch)
treed1ac1265b39a9c253c9d71a20f3b84f7340eb63c /deflate.h
parenteea078bd3b14eb1546c464c4798ace5f7adfb934 (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.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/deflate.h b/deflate.h
index acd342d..37e5596 100644
--- a/deflate.h
+++ b/deflate.h
@@ -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) { \