Get the data from *ptr after casting according to @p data_type and then convert the data to double. * * @param[in] ptr Pointer to value. * @param[in] data_type Data type of both values. * * @return The data from the ptr after converted to double. */
| 50 | * @return The data from the ptr after converted to double. |
| 51 | */ |
| 52 | double get_double_data(const void *ptr, DataType data_type) |
| 53 | { |
| 54 | if (ptr == nullptr) |
| 55 | { |
| 56 | ARM_COMPUTE_ERROR("Can't dereference a null pointer!"); |
| 57 | } |
| 58 | |
| 59 | switch (data_type) |
| 60 | { |
| 61 | case DataType::U8: |
| 62 | return *reinterpret_cast<const uint8_t *>(ptr); |
| 63 | case DataType::S8: |
| 64 | return *reinterpret_cast<const int8_t *>(ptr); |
| 65 | case DataType::U16: |
| 66 | return *reinterpret_cast<const uint16_t *>(ptr); |
| 67 | case DataType::S16: |
| 68 | return *reinterpret_cast<const int16_t *>(ptr); |
| 69 | case DataType::U32: |
| 70 | return *reinterpret_cast<const uint32_t *>(ptr); |
| 71 | case DataType::S32: |
| 72 | return *reinterpret_cast<const int32_t *>(ptr); |
| 73 | case DataType::U64: |
| 74 | return *reinterpret_cast<const uint64_t *>(ptr); |
| 75 | case DataType::S64: |
| 76 | return *reinterpret_cast<const int64_t *>(ptr); |
| 77 | case DataType::F16: |
| 78 | return *reinterpret_cast<const half *>(ptr); |
| 79 | case DataType::F32: |
| 80 | return *reinterpret_cast<const float *>(ptr); |
| 81 | case DataType::F64: |
| 82 | return *reinterpret_cast<const double *>(ptr); |
| 83 | case DataType::SIZET: |
| 84 | return *reinterpret_cast<const size_t *>(ptr); |
| 85 | default: |
| 86 | ARM_COMPUTE_ERROR("NOT SUPPORTED!"); |
| 87 | } |
| 88 | } |
| 89 | |
| 90 | void check_border_element(const IAccessor &tensor, |
| 91 | const Coordinates &id, |
no outgoing calls
no test coverage detected