util.h 564 B

123456789101112131415161718192021
  1. // Copyright 2018 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. #ifndef BASE_CONTAINERS_UTIL_H_
  5. #define BASE_CONTAINERS_UTIL_H_
  6. #include <stdint.h>
  7. namespace base {
  8. // TODO(crbug.com/817982): What we really need is for checked_math.h to be
  9. // able to do checked arithmetic on pointers.
  10. template <typename T>
  11. static inline uintptr_t get_uintptr(const T* t) {
  12. return reinterpret_cast<uintptr_t>(t);
  13. }
  14. } // namespace base
  15. #endif // BASE_CONTAINERS_UTIL_H_