From 053e7510f24c2b02f9fae9c45fb6b874631a5376 Mon Sep 17 00:00:00 2001 From: Manuel Bottini Date: Fri, 28 Dec 2018 15:05:20 +0000 Subject: COMPMID-1758: NEON: Implement Range Change-Id: I56dff9462b85760fbed6db43224cadb90d283810 Reviewed-on: https://review.mlplatform.org/472 Reviewed-by: Georgios Pinitas Tested-by: Arm Jenkins --- utils/Utils.h | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'utils') 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 -- cgit v1.2.1