| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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 "sync/internal_api/public/base/node_ordinal.h" | 5 #include "components/sync/base/node_ordinal.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| 11 #include <string> | 11 #include <string> |
| 12 | 12 |
| 13 namespace syncer { | 13 namespace syncer { |
| 14 | 14 |
| 15 NodeOrdinal Int64ToNodeOrdinal(int64_t x) { | 15 NodeOrdinal Int64ToNodeOrdinal(int64_t x) { |
| (...skipping 26 matching lines...) Expand all Loading... |
| 42 const uint8_t byte = s[l - i - 1]; | 42 const uint8_t byte = s[l - i - 1]; |
| 43 y |= static_cast<uint64_t>(byte) << (i * 8); | 43 y |= static_cast<uint64_t>(byte) << (i * 8); |
| 44 } | 44 } |
| 45 y ^= 0x8000000000000000ULL; | 45 y ^= 0x8000000000000000ULL; |
| 46 // This is technically implementation-defined if y > INT64_MAX, so | 46 // This is technically implementation-defined if y > INT64_MAX, so |
| 47 // we're assuming that we're on a twos-complement machine. | 47 // we're assuming that we're on a twos-complement machine. |
| 48 return static_cast<int64_t>(y); | 48 return static_cast<int64_t>(y); |
| 49 } | 49 } |
| 50 | 50 |
| 51 } // namespace syncer | 51 } // namespace syncer |
| OLD | NEW |