X-Git-Url: http://plrg.eecs.uci.edu/git/?a=blobdiff_plain;f=folly%2Ftest%2FGroupVarintTest.cpp;h=2971ca1a06116d582cf801d721884cac27661c16;hb=275ca94d04e44f28cfa411668eb1c1dd8db90b80;hp=1e59016dd3d735c5096e6d0c2924a3b34682349e;hpb=5c77fedbef46995a71ffa268c9fcaf49efddd01b;p=folly.git diff --git a/folly/test/GroupVarintTest.cpp b/folly/test/GroupVarintTest.cpp index 1e59016d..2971ca1a 100644 --- a/folly/test/GroupVarintTest.cpp +++ b/folly/test/GroupVarintTest.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2013 Facebook, Inc. + * Copyright 2015 Facebook, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,7 +15,11 @@ */ #include -#include "folly/GroupVarint.h" +#include +#include + +// On platforms where it's not supported, GroupVarint will be compiled out. +#if HAVE_GROUP_VARINT #include @@ -53,7 +57,10 @@ void testGroupVarint32(uint32_t a, uint32_t b, uint32_t c, uint32_t d, ...) { EXPECT_EQ(expectedBytes.size(), size); std::vector foundBytes; - foundBytes.resize(size + 4); + + // ssse3 decoding requires that the source buffer have length >= 17, + // so that it can read 128 bits from &start[1] via _mm_loadu_si128. + foundBytes.resize(std::max(size + 4, 17UL)); char* start = &(foundBytes.front()); char* p = GroupVarint32::encode(start, a, b, c, d); EXPECT_EQ((void*)(start + size), (void*)p); @@ -259,3 +266,4 @@ TEST(GroupVarint, GroupVarintDecoder) { } } +#endif