diff options
author | Manuel Bottini <manuel.bottini@arm.com> | 2018-12-28 15:05:20 +0000 |
---|---|---|
committer | Manuel Bottini <manuel.bottini@arm.com> | 2019-01-14 13:53:18 +0000 |
commit | 053e7510f24c2b02f9fae9c45fb6b874631a5376 (patch) | |
tree | 2da0a155512637017fb011a11f8c2f8bab494fa2 /utils/Utils.h | |
parent | b412fab0e3c8ec10e104f4d85760898a5b26179c (diff) | |
download | ComputeLibrary-053e7510f24c2b02f9fae9c45fb6b874631a5376.tar.gz |
COMPMID-1758: NEON: Implement Range
Change-Id: I56dff9462b85760fbed6db43224cadb90d283810
Reviewed-on: https://review.mlplatform.org/472
Reviewed-by: Georgios Pinitas <georgios.pinitas@arm.com>
Tested-by: Arm Jenkins <bsgcomp@arm.com>
Diffstat (limited to 'utils/Utils.h')
-rw-r--r-- | utils/Utils.h | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/utils/Utils.h b/utils/Utils.h index 031a3726a1..ad71776803 100644 --- a/utils/Utils.h +++ b/utils/Utils.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2018 ARM Limited. + * Copyright (c) 2016-2019 ARM Limited. * * SPDX-License-Identifier: MIT * @@ -194,6 +194,20 @@ inline std::string get_typestring(DataType data_type) } } +/** Returns the number of elements required to go from start to end with the wanted step + * + * @param[in] start start value + * @param[in] end end value + * @param[in] step step value between each number in the wanted sequence + * + * @return number of elements to go from start value to end value using the wanted step + */ +inline size_t num_of_elements_in_range(const float start, const float end, const float step) +{ + ARM_COMPUTE_ERROR_ON_MSG(step == 0, "Range Step cannot be 0"); + return size_t(std::ceil((end - start) / step)); +} + /** Returns true if the value can be represented by the given data type * * @param[in] val value to be checked |