| 28 | // critical contexts where 0 <= index < limit is almost always true. |
| 29 | template <typename Ta, typename Tb> |
| 30 | EIGEN_ALWAYS_INLINE EIGEN_DEVICE_FUNC bool FastBoundsCheck(const Ta index, |
| 31 | const Tb limit) { |
| 32 | static_assert(std::is_integral<Ta>::value && std::is_integral<Tb>::value, |
| 33 | "FastBoundsCheck can only be used on integer types."); |
| 34 | typedef typename std::make_unsigned<decltype(index + limit)>::type UIndex; |
| 35 | return TF_PREDICT_TRUE(static_cast<UIndex>(index) < |
| 36 | static_cast<UIndex>(limit)); |
| 37 | } |
| 38 | |
| 39 | namespace internal { |
| 40 | // Ensure that the compiler cannot elide a copy into a local, for |
no outgoing calls
no test coverage detected