1 | /* Copyright 2015 The TensorFlow Authors. All Rights Reserved. |
2 | |
3 | Licensed under the Apache License, Version 2.0 (the "License"); |
4 | you may not use this file except in compliance with the License. |
5 | You may obtain a copy of the License at |
6 | |
7 | http://www.apache.org/licenses/LICENSE-2.0 |
8 | |
9 | Unless required by applicable law or agreed to in writing, software |
10 | distributed under the License is distributed on an "AS IS" BASIS, |
11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
12 | See the License for the specific language governing permissions and |
13 | limitations under the License. |
14 | ==============================================================================*/ |
15 | |
16 | #ifndef TENSORFLOW_TSL_PLATFORM_TYPES_H_ |
17 | #define TENSORFLOW_TSL_PLATFORM_TYPES_H_ |
18 | |
19 | #include <string> |
20 | |
21 | #include "tensorflow/tsl/platform/bfloat16.h" |
22 | #include "tensorflow/tsl/platform/platform.h" |
23 | #include "tensorflow/tsl/platform/tstring.h" |
24 | |
25 | // Include appropriate platform-dependent implementations |
26 | #if defined(PLATFORM_GOOGLE) || defined(GOOGLE_INTEGRAL_TYPES) |
27 | #include "tensorflow/tsl/platform/google/integral_types.h" // IWYU pragma: export |
28 | #elif defined(PLATFORM_POSIX) || defined(PLATFORM_POSIX_ANDROID) || \ |
29 | defined(PLATFORM_GOOGLE_ANDROID) || defined(PLATFORM_POSIX_IOS) || \ |
30 | defined(PLATFORM_GOOGLE_IOS) || defined(PLATFORM_WINDOWS) |
31 | #include "tensorflow/tsl/platform/default/integral_types.h" // IWYU pragma: export |
32 | #else |
33 | #error Define the appropriate PLATFORM_<foo> macro for this platform |
34 | #endif |
35 | |
36 | namespace tsl { |
37 | |
38 | // Alias tsl::string to std::string. |
39 | using std::string; |
40 | |
41 | static const uint8 kuint8max = static_cast<uint8>(0xFF); |
42 | static const uint16 kuint16max = static_cast<uint16>(0xFFFF); |
43 | static const uint32 kuint32max = static_cast<uint32>(0xFFFFFFFF); |
44 | static const uint64 kuint64max = static_cast<uint64>(0xFFFFFFFFFFFFFFFFull); |
45 | static const int8_t kint8min = static_cast<int8>(~0x7F); |
46 | static const int8_t kint8max = static_cast<int8>(0x7F); |
47 | static const int16_t kint16min = static_cast<int16>(~0x7FFF); |
48 | static const int16_t kint16max = static_cast<int16>(0x7FFF); |
49 | static const int32_t kint32min = static_cast<int32>(~0x7FFFFFFF); |
50 | static const int32_t kint32max = static_cast<int32>(0x7FFFFFFF); |
51 | static const int64_t kint64min = static_cast<int64_t>(~0x7FFFFFFFFFFFFFFFll); |
52 | static const int64_t kint64max = static_cast<int64_t>(0x7FFFFFFFFFFFFFFFll); |
53 | |
54 | // A typedef for a uint64 used as a short fingerprint. |
55 | using Fprint = uint64; |
56 | |
57 | } // namespace tsl |
58 | |
59 | // Alias namespace ::stream_executor as ::tensorflow::se. |
60 | namespace stream_executor {} |
61 | namespace tensorflow { |
62 | namespace se = ::stream_executor; |
63 | } // namespace tensorflow |
64 | |
65 | #if defined(PLATFORM_WINDOWS) |
66 | #include <cstddef> |
67 | typedef std::ptrdiff_t ssize_t; |
68 | #endif |
69 | |
70 | #endif // TENSORFLOW_TSL_PLATFORM_TYPES_H_ |
71 | |