Revert "Reland c91b178b07b0d - Delete dead signin code (SigninGlobalError)"
[chromium-blink-merge.git] / chrome / browser / metrics / variations / generated_resources_map_lookup.cc
blob3430257c1c7520a174633c4ee78315bb7d1d0745
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 "chrome/browser/metrics/variations/generated_resources_map.h"
7 #include <algorithm>
9 namespace chrome_variations {
11 int GetResourceIndex(uint32_t hash) {
12 const uint32_t* kEnd = kResourceHashes + kNumResources;
13 const uint32_t* element = std::lower_bound(kResourceHashes, kEnd, hash);
15 if (element == kEnd || *element != hash)
16 return -1;
17 return kResourceIndices[element - kResourceHashes];
20 } // namespace chrome_variations