Updating trunk VERSION from 2139.0 to 2140.0
[chromium-blink-merge.git] / net / spdy / hpack_string_util.cc
blobdddb85513bc6403d6c061537a801476e772d81a5
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
3 // found in the LICENSE file.
5 #include "net/spdy/hpack_string_util.h"
7 #include "base/basictypes.h"
9 namespace net {
11 bool StringPiecesEqualConstantTime(base::StringPiece str1,
12 base::StringPiece str2) {
13 size_t size = str1.size();
14 if (str2.size() != size)
15 return false;
17 uint8 x = 0;
18 for (size_t i = 0; i < size; ++i) {
19 x |= str1[i] ^ str2[i];
21 return x == 0;
24 } // namespace net