1/* Copyright 2015 The TensorFlow Authors. All Rights Reserved.
2
3Licensed under the Apache License, Version 2.0 (the "License");
4you may not use this file except in compliance with the License.
5You may obtain a copy of the License at
6
7 http://www.apache.org/licenses/LICENSE-2.0
8
9Unless required by applicable law or agreed to in writing, software
10distributed under the License is distributed on an "AS IS" BASIS,
11WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12See the License for the specific language governing permissions and
13limitations 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
36namespace tsl {
37
38// Alias tsl::string to std::string.
39using std::string;
40
41static const uint8 kuint8max = static_cast<uint8>(0xFF);
42static const uint16 kuint16max = static_cast<uint16>(0xFFFF);
43static const uint32 kuint32max = static_cast<uint32>(0xFFFFFFFF);
44static const uint64 kuint64max = static_cast<uint64>(0xFFFFFFFFFFFFFFFFull);
45static const int8_t kint8min = static_cast<int8>(~0x7F);
46static const int8_t kint8max = static_cast<int8>(0x7F);
47static const int16_t kint16min = static_cast<int16>(~0x7FFF);
48static const int16_t kint16max = static_cast<int16>(0x7FFF);
49static const int32_t kint32min = static_cast<int32>(~0x7FFFFFFF);
50static const int32_t kint32max = static_cast<int32>(0x7FFFFFFF);
51static const int64_t kint64min = static_cast<int64_t>(~0x7FFFFFFFFFFFFFFFll);
52static const int64_t kint64max = static_cast<int64_t>(0x7FFFFFFFFFFFFFFFll);
53
54// A typedef for a uint64 used as a short fingerprint.
55using Fprint = uint64;
56
57} // namespace tsl
58
59// Alias namespace ::stream_executor as ::tensorflow::se.
60namespace stream_executor {}
61namespace tensorflow {
62namespace se = ::stream_executor;
63} // namespace tensorflow
64
65#if defined(PLATFORM_WINDOWS)
66#include <cstddef>
67typedef std::ptrdiff_t ssize_t;
68#endif
69
70#endif // TENSORFLOW_TSL_PLATFORM_TYPES_H_
71