Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 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. | |
| 4 | |
|
Alexei Svitkine (slow)
2014/02/04 18:30:43
Can you maybe add a few lines of comment here abou
| |
| 5 #include <stdio.h> | |
| 6 #include <stdlib.h> | |
| 7 #include <string.h> | |
| 8 | |
| 9 #include "base/hash.h" | |
| 10 #include "base/macros.h" | |
| 11 | |
| 12 int main(int argc, char **argv) { | |
| 13 if (argc != 2) { | |
| 14 fprintf(stderr, "Usage: %s <interface_name>", argv[0]); | |
| 15 return 1; | |
| 16 } | |
| 17 uint32 data = base::Hash(argv[1], strlen(argv[1])); | |
| 18 | |
| 19 // Strip off the signed bit because UMA doesn't support negative values, | |
| 20 // but takes a signed int as input. | |
| 21 int hash = static_cast<int>(data & 0x7fffffff); | |
| 22 printf("%s: %d\n", argv[1], hash); | |
| 23 return 0; | |
| 24 } | |
| OLD | NEW |