Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(483)

Side by Side Diff: net/spdy/core/fuzzing/hpack_fuzz_util.cc

Issue 2832973003: Split net/spdy into core and chromium subdirectories. (Closed)
Patch Set: Fix some more build rules. Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « net/spdy/core/fuzzing/hpack_fuzz_util.h ('k') | net/spdy/core/fuzzing/hpack_fuzz_util_test.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "net/spdy/fuzzing/hpack_fuzz_util.h" 5 #include "net/spdy/core/fuzzing/hpack_fuzz_util.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 9
10 #include "base/rand_util.h" 10 #include "base/rand_util.h"
11 #include "base/sys_byteorder.h" 11 #include "base/sys_byteorder.h"
12 #include "net/spdy/hpack/hpack_constants.h" 12 #include "net/spdy/core/hpack/hpack_constants.h"
13 13
14 namespace net { 14 namespace net {
15 15
16 namespace { 16 namespace {
17 17
18 // Sampled exponential distribution parameters: 18 // Sampled exponential distribution parameters:
19 // Number of headers in each header set. 19 // Number of headers in each header set.
20 const size_t kHeaderCountMean = 7; 20 const size_t kHeaderCountMean = 7;
21 const size_t kHeaderCountMax = 50; 21 const size_t kHeaderCountMax = 50;
22 // Selected index within list of headers. 22 // Selected index within list of headers.
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 uint64_t bits_to_flip = flip_per_thousand * (1 + buffer_bit_length / 1024); 181 uint64_t bits_to_flip = flip_per_thousand * (1 + buffer_bit_length / 1024);
182 182
183 // Iteratively identify & flip offsets in the buffer bit-sequence. 183 // Iteratively identify & flip offsets in the buffer bit-sequence.
184 for (uint64_t i = 0; i != bits_to_flip; ++i) { 184 for (uint64_t i = 0; i != bits_to_flip; ++i) {
185 uint64_t bit_offset = base::RandUint64() % buffer_bit_length; 185 uint64_t bit_offset = base::RandUint64() % buffer_bit_length;
186 buffer[bit_offset / 8u] ^= (1 << (bit_offset % 8u)); 186 buffer[bit_offset / 8u] ^= (1 << (bit_offset % 8u));
187 } 187 }
188 } 188 }
189 189
190 } // namespace net 190 } // namespace net
OLDNEW
« no previous file with comments | « net/spdy/core/fuzzing/hpack_fuzz_util.h ('k') | net/spdy/core/fuzzing/hpack_fuzz_util_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698