diff options
Diffstat (limited to 'arm_compute/core/FixedPoint.inl')
-rw-r--r-- | arm_compute/core/FixedPoint.inl | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/arm_compute/core/FixedPoint.inl b/arm_compute/core/FixedPoint.inl index b921b32ed9..5ea0f6c825 100644 --- a/arm_compute/core/FixedPoint.inl +++ b/arm_compute/core/FixedPoint.inl @@ -21,6 +21,8 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ +#include "arm_compute/core/Error.h" + #include <cmath> #include <limits> @@ -59,6 +61,20 @@ inline qint16_t sqshl_qs16(qint16_t a, int shift) return saturate_convert<qint32_t, qint16_t>(tmp); } +inline qint8_t sshr_qs8(qint8_t a, int shift) +{ + ARM_COMPUTE_ERROR_ON_MSG(shift == 0, "Shift should not be zero"); + const qint8_t round_val = 1 << (shift - 1); + return sqadd_qs8(a, round_val) >> shift; +} + +inline qint16_t sshr_qs16(qint16_t a, int shift) +{ + ARM_COMPUTE_ERROR_ON_MSG(shift == 0, "Shift should not be zero"); + const qint16_t round_val = 1 << (shift - 1); + return sqadd_qs16(a, round_val) >> shift; +} + inline qint8_t sabs_qs8(qint8_t a) { return (a < 0) ? (a == std::numeric_limits<int8_t>::min()) ? std::numeric_limits<int8_t>::max() : -a : a; |