summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGregory Maxwell <greg@xiph.org>2012-05-04 20:01:56 -0400
committerJean-Marc Valin <jmvalin@jmvalin.ca>2012-05-10 14:44:56 -0400
commitd17bcbf1b30f1233c093d77665a93841dcd2eff5 (patch)
treea0ae6cadf0b1ac40123d0367f56cfab291e15a16
parent5eeeda96d0fa0ab7d06c7fad8faca133ed95877f (diff)
downloadopus-d17bcbf1b30f1233c093d77665a93841dcd2eff5.tar.gz
Increase alignment of the internal state structures to sizeof(void *) from 4 bytes.
OpusCustomMode begins with a pointer and was getting misaligned on 64 bit arches.
-rw-r--r--src/opus_private.h5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/opus_private.h b/src/opus_private.h
index 675c2c46..7e27b902 100644
--- a/src/opus_private.h
+++ b/src/opus_private.h
@@ -79,11 +79,10 @@ int encode_size(int size, unsigned char *data);
int opus_decode_native(OpusDecoder *st, const unsigned char *data, int len,
opus_val16 *pcm, int frame_size, int decode_fec, int self_delimited, int *packet_offset);
-/* Make sure everything's aligned to 4 bytes (this may need to be increased
- on really weird architectures) */
+/* Make sure everything's aligned to sizeof(void *) bytes */
static inline int align(int i)
{
- return (i+3)&-4;
+ return (i+sizeof(void *)-1)&-sizeof(void *);
}
int opus_repacketizer_out_range_impl(OpusRepacketizer *rp, int begin, int end, unsigned char *data, int maxlen, int self_delimited);