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

Side by Side Diff: net/quic/quic_fec_group_interface.cc

Issue 2011653004: Remove obsolete fields in quic_protocol and their current usage in QUIC. Reorders QuicAckFrame fie… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@122721477
Patch Set: Created 4 years, 6 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/quic/quic_fec_group_interface.h ('k') | net/quic/quic_fec_group_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
(Empty)
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "net/quic/quic_fec_group_interface.h"
6
7 #include <limits>
8
9 #include "base/logging.h"
10 #include "base/stl_util.h"
11
12 namespace net {
13
14 void QuicFecGroupInterface::XorBuffers(const char* input,
15 size_t size_in_bytes,
16 char* output) {
17 #if defined(__i386__) || defined(__x86_64__)
18 // On x86, alignment is not required and casting bytes to words is safe.
19
20 // size_t is a reasonable approximation of how large a general-purpose
21 // register is for the platforms and compilers Chrome is built on.
22 typedef size_t platform_word;
23 const size_t size_in_words = size_in_bytes / sizeof(platform_word);
24
25 const platform_word* input_words =
26 reinterpret_cast<const platform_word*>(input);
27 platform_word* output_words = reinterpret_cast<platform_word*>(output);
28
29 // Handle word-sized part of the buffer.
30 size_t offset_in_words = 0;
31 for (; offset_in_words < size_in_words; offset_in_words++) {
32 output_words[offset_in_words] ^= input_words[offset_in_words];
33 }
34
35 // Handle the tail which does not fit into the word.
36 for (size_t offset_in_bytes = offset_in_words * sizeof(platform_word);
37 offset_in_bytes < size_in_bytes; offset_in_bytes++) {
38 output[offset_in_bytes] ^= input[offset_in_bytes];
39 }
40 #else
41 // On ARM and most other plaforms, the code above could fail due to the
42 // alignment errors. Stick to byte-by-byte comparison.
43 for (size_t offset = 0; offset < size_in_bytes; offset++) {
44 output[offset] ^= input[offset];
45 }
46 #endif /* defined(__i386__) || defined(__x86_64__) */
47 }
48
49 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_fec_group_interface.h ('k') | net/quic/quic_fec_group_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698