18 using namespace folly;
33 tie(code, bits) = tree_.getCode(
'e');
37 tie(code, bits) = tree_.getCode(0);
40 tie(code, bits) = tree_.getCode(255);
48 size = tree_.getEncodeSize(onebyte);
52 size = tree_.getEncodeSize(accept);
65 size = tree_.encode(gzip, appender);
75 size = tree_.getEncodeSize(accept);
76 uint32_t encodedSize = tree_.encode(accept, appender);
86 tree_.decode(buffer, 2, literal);
94 tree_.decode(buffer, 3, literal);
101 tree_.decode(buffer, 2, literal);
111 0xFF, 0xFF, 0xEA, 0xF8
114 tree_.decode(buffer1, 4, literal);
122 0xFF, 0xFF, 0xB1, 0xFF, 0xFF, 0xF5, 0xFF
125 tree_.decode(buffer2, 7, literal);
140 uint32_t encodedSize = tree_.encode(example, appender);
145 CHECK_EQ(example, decoded);
150 "Mozilla/5.0 (iPhone; CPU iPhone OS 7_0_4 like Mac OS X) AppleWebKit/537.51" 151 ".1 (KHTML, like Gecko) Mobile/11B554a [FBAN/FBIOS;FBAV/6.7;FBBV/566055;FBD" 152 "V/iPhone5,1;FBMD/iPhone;FBSN/iPhone OS;FBSV/7.0.4;FBSS/2; FBCR/AT&T;FBID/p" 153 "hone;FBLC/en_US;FBOP/5]");
164 CHECK_EQ(user_agent, decoded);
176 tree_.encode(literal, appender);
182 tree_.encode(literal, appender);
183 CHECK_EQ(appender.
length(), 0);
209 unordered_set<uint32_t> leaves;
215 uint32_t newFullCode = fullCode ^ (
i << (24 - 8 * depth));
216 uint32_t eosCodeDepth = (eosCodeBits - 1) / 8;
218 if(eosCodeDepth == depth
219 && (newFullCode >> (32 - eosCodeBits)) == eosCode) {
226 }
else if (node.
isLeaf()) {
236 leaves.insert(node.
data.
ch);
257 return subtreeLeafCount + leaves.size();
283 uint32_t totalReqChars =
treeDfs(allSnodesReq, 0, 0, 0, 0x3fffffff, 30);
std::vector< uint8_t > buffer(kBufferSize+16)
const folly::IOBuf * front() const
uint32_t treeDfs(const SuperHuffNode *allSnodes, const uint32_t &snodeIndex, const uint32_t &depth, const uint32_t &fullCode, const uint32_t &eosCode, const uint32_t &eosCodeBits)
#define EXPECT_EQ(val1, val2)
const uint8_t * data() const
uint32_t encode(folly::StringPiece literal, folly::io::QueueAppender &buf) const
—— Concurrent Priority Queue Implementation ——
static TestingHuffTree getHuffTree()
struct proxygen::huffman::HuffNode::@104 metadata
const SuperHuffNode * getInternalTable()
constexpr auto size(C const &c) -> decltype(c.size())
union proxygen::huffman::HuffNode::@103 data
uint32_t getEncodeSize(folly::StringPiece literal) const
constexpr auto data(C &c) -> decltype(c.data())
TEST_F(AsyncSSLSocketWriteTest, write_coalescing1)
#define EXPECT_TRUE(condition)
const HuffTree & huffTree()
bool decode(const uint8_t *buf, uint32_t size, folly::fbstring &literal) const
TestingHuffTree(const HuffTree &tree)
NetworkSocket accept(NetworkSocket s, sockaddr *addr, socklen_t *addrlen)