Fix unaligned data in self test

AltiVec and Power8 are brutal. The SIMD units just mask-off the lower 3 address bits. They make the buffer aligned whethere it is aligned or not
pull/489/head
Jeffrey Walton 2017-09-03 11:17:57 -04:00
parent b9e871d1e8
commit e7974c7915
No known key found for this signature in database
GPG Key ID: B36AB348921B1838
1 changed files with 6 additions and 6 deletions

View File

@ -2467,16 +2467,16 @@ bool TestHuffmanCodes()
{
try
{
byte data1[0xfff]; // Place on stack, avoid new
unsigned int data2[0xff];
SecByteBlock data1(0xfff);
SecBlock<word32> data2(0xff);
unsigned int len1 = GlobalRNG().GenerateWord32(4, 0xfff);
GlobalRNG().GenerateBlock(data1, len1);
GlobalRNG().GenerateBlock(data1.BytePtr(), data1.SizeInBytes());
unsigned int len2 = GlobalRNG().GenerateWord32(4, 0xff);
GlobalRNG().GenerateBlock((byte*)data2, len2*sizeof(unsigned int));
GlobalRNG().GenerateBlock(data2.BytePtr(), data2.SizeInBytes());
ArraySource source(data1, len1, false);
HuffmanDecoder decoder(data2, len2);
ArraySource source(data1.BytePtr(), data1.SizeInBytes(), false);
HuffmanDecoder decoder(data2.begin(), data2.size());
LowFirstBitReader reader(source);
unsigned int val;