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_PLATFORM_TYPES_H_ 17 #define TENSORFLOW_PLATFORM_TYPES_H_ 18 19 #include <string> 20 #include "tensorflow/core/platform/platform.h" 21 22 // Include appropriate platform-dependent implementations 23 #if defined(PLATFORM_GOOGLE) || defined(GOOGLE_INTEGRAL_TYPES) 24 #include "tensorflow/core/platform/google/integral_types.h" 25 #elif defined(PLATFORM_WINDOWS) 26 #include "tensorflow/core/platform/windows/integral_types.h" 27 #elif defined(PLATFORM_POSIX) || defined(PLATFORM_POSIX_ANDROID) || \ 28 defined(PLATFORM_GOOGLE_ANDROID) 29 #include "tensorflow/core/platform/default/integral_types.h" 30 #else 31 #error Define the appropriate PLATFORM_<foo> macro for this platform 32 #endif 33 34 #if defined(PLATFORM_WINDOWS) 35 #include "tensorflow/core/platform/windows/cpu_info.h" 36 #endif 37 38 #include "tensorflow/core/lib/bfloat16/bfloat16.h" 39 40 namespace tensorflow { 41 42 // Define tensorflow::string to refer to appropriate platform specific type. 43 // TODO(josh11b): Move this into the platform/*/integral_types.h files 44 // above, and rename them platform/*/types.h. 45 #if defined(PLATFORM_GOOGLE) 46 using ::string; 47 #else 48 using std::string; 49 #endif 50 51 static const uint8 kuint8max = ((uint8)0xFF); 52 static const uint16 kuint16max = ((uint16)0xFFFF); 53 static const uint32 kuint32max = ((uint32)0xFFFFFFFF); 54 static const uint64 kuint64max = ((uint64)0xFFFFFFFFFFFFFFFFull); 55 static const int8 kint8min = ((int8)~0x7F); 56 static const int8 kint8max = ((int8)0x7F); 57 static const int16 kint16min = ((int16)~0x7FFF); 58 static const int16 kint16max = ((int16)0x7FFF); 59 static const int32 kint32min = ((int32)~0x7FFFFFFF); 60 static const int32 kint32max = ((int32)0x7FFFFFFF); 61 static const int64 kint64min = ((int64)~0x7FFFFFFFFFFFFFFFll); 62 static const int64 kint64max = ((int64)0x7FFFFFFFFFFFFFFFll); 63 64 // A typedef for a uint64 used as a short fingerprint. 65 typedef uint64 Fprint; 66 67 } // namespace tensorflow 68 69 #endif // TENSORFLOW_PLATFORM_TYPES_H_ 70