From cf305dbb7f3e3be7c4e6c71174e1183eb489ec03 Mon Sep 17 00:00:00 2001 From: Jerry Ge Date: Mon, 6 Mar 2023 13:07:36 -0800 Subject: Refactor 1L to INT64_C() Signed-off-by: Jerry Ge Change-Id: If3f8c5a1f2dffac36448101959557f86b6ab6c7f --- reference_model/src/ops/ewise_binary.cc | 2 +- reference_model/src/ops/template_types.h | 34 ++++++++++++++++---------------- 2 files changed, 18 insertions(+), 18 deletions(-) (limited to 'reference_model/src/ops') diff --git a/reference_model/src/ops/ewise_binary.cc b/reference_model/src/ops/ewise_binary.cc index c697db0..16386af 100644 --- a/reference_model/src/ops/ewise_binary.cc +++ b/reference_model/src/ops/ewise_binary.cc @@ -434,7 +434,7 @@ int OpMul::register_fcn() int64_t result; if (shift > 0) { - int64_t round = 1L << (shift - 1); + int64_t round = INT64_C(1) << (shift - 1); result = static_cast(a) * static_cast(b) + round; result = result >> shift; diff --git a/reference_model/src/ops/template_types.h b/reference_model/src/ops/template_types.h index 6b28502..ece14b1 100644 --- a/reference_model/src/ops/template_types.h +++ b/reference_model/src/ops/template_types.h @@ -1,5 +1,5 @@ -// Copyright (c) 2020-2022, ARM Limited. +// Copyright (c) 2020-2023, ARM Limited. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -196,83 +196,83 @@ struct GetNumBits template struct GetQMin { - static constexpr int64_t value = 0L; + static constexpr int64_t value = INT64_C(0); }; template <> struct GetQMin { - static constexpr int64_t value = 0L; + static constexpr int64_t value = INT64_C(0); }; template <> struct GetQMin { - static constexpr int64_t value = 0L; + static constexpr int64_t value = INT64_C(0); }; template <> struct GetQMin { - static constexpr int64_t value = -8L; + static constexpr int64_t value = INT64_C(-8); }; template <> struct GetQMin { - static constexpr int64_t value = -128L; + static constexpr int64_t value = INT64_C(-128); }; template <> struct GetQMin { - static constexpr int64_t value = -32768L; + static constexpr int64_t value = INT64_C(-32768); }; template <> struct GetQMin { - static constexpr int64_t value = -(1L << 31); + static constexpr int64_t value = -(INT64_C(1) << 31); }; template <> struct GetQMin { - static constexpr int64_t value = -(1L << 47); + static constexpr int64_t value = -(INT64_C(1) << 47); }; template struct GetQMax { - static constexpr int64_t value = 0L; + static constexpr int64_t value = INT64_C(0); }; template <> struct GetQMax { - static constexpr int64_t value = 255L; + static constexpr int64_t value = INT64_C(255); }; template <> struct GetQMax { - static constexpr int64_t value = 65535L; + static constexpr int64_t value = INT64_C(65535); }; template <> struct GetQMax { - static constexpr int64_t value = 7L; + static constexpr int64_t value = INT64_C(7); }; template <> struct GetQMax { - static constexpr int64_t value = 127L; + static constexpr int64_t value = INT64_C(127); }; template <> struct GetQMax { - static constexpr int64_t value = 32767L; + static constexpr int64_t value = INT64_C(32767); }; template <> struct GetQMax { - static constexpr int64_t value = (1L << 31) - 1; + static constexpr int64_t value = (INT64_C(1) << 31) - 1; }; template <> struct GetQMax { - static constexpr int64_t value = (1L << 47) - 1; + static constexpr int64_t value = (INT64_C(1) << 47) - 1; }; }; // namespace TosaReference -- cgit v1.2.1