| 235 | */ |
| 236 | template<typename ItType, typename ValType> |
| 237 | AMREX_GPU_HOST_DEVICE |
| 238 | ItType upper_bound (ItType first, ItType last, const ValType& val) |
| 239 | { |
| 240 | AMREX_IF_ON_DEVICE(( |
| 241 | std::ptrdiff_t count = last-first; |
| 242 | while(count>0){ |
| 243 | auto it = first; |
| 244 | const auto step = count/2; |
| 245 | it += step; |
| 246 | if (!(val < *it)){ |
| 247 | first = ++it; |
| 248 | count -= step + 1; |
| 249 | } |
| 250 | else{ |
| 251 | count = step; |
| 252 | } |
| 253 | } |
| 254 | return first; |
| 255 | )) |
| 256 | AMREX_IF_ON_HOST(( |
| 257 | return std::upper_bound(first, last, val); |
| 258 | )) |
| 259 | } |
| 260 | |
| 261 | /** |
| 262 | * \brief Return an iterator to the first element not less than a given |
no outgoing calls
no test coverage detected