Skip to content

Commit f57acf8

Browse files
committed
NXP Backend: Fix Coverity problems in neutron backend
1 parent 930ecfd commit f57acf8

File tree

1 file changed

+21
-21
lines changed

1 file changed

+21
-21
lines changed

backends/nxp/runtime/NeutronBackend.cpp

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -42,27 +42,27 @@ namespace neutron {
4242
+-----------------------------------------------------------------------------------+
4343
*/
4444
// clang-format on
45-
#define ITEM_SIZE 1 // 1 Byte
46-
#define INPUT_TENSOR_FORMAT_LEN_POS 0
47-
#define OUTPUT_TENSOR_FORMAT_LEN_POS 1
48-
#define INPUT_ARGS_LEN_POS 2
49-
#define INPUT_TENSOR_FORMAT_ARRAY_ADDR(base) (base + 3 * ITEM_SIZE)
45+
#define ITEM_SIZE 1U // 1 Byte
46+
#define INPUT_TENSOR_FORMAT_LEN_POS 0U
47+
#define OUTPUT_TENSOR_FORMAT_LEN_POS 1U
48+
#define INPUT_ARGS_LEN_POS 2U
49+
#define INPUT_TENSOR_FORMAT_ARRAY_ADDR(base) (base + 3U * ITEM_SIZE)
5050
#define OUTPUT_TENSOR_FORMAT_ARRAY_ADDR(base) \
51-
(base + 3 * ITEM_SIZE + base[INPUT_TENSOR_FORMAT_LEN_POS])
52-
#define INPUT_TENSOR_MAP_ARRAY_ADDR(base) \
53-
(base + 3 * ITEM_SIZE + 1 * base[INPUT_TENSOR_FORMAT_LEN_POS] + \
54-
1 * base[OUTPUT_TENSOR_FORMAT_LEN_POS])
55-
#define OUTPUT_TENSOR_MAP_ARRAY_ADDR(base) \
56-
(base + 3 * ITEM_SIZE + 2 * base[INPUT_TENSOR_FORMAT_LEN_POS] + \
57-
1 * base[OUTPUT_TENSOR_FORMAT_LEN_POS])
58-
#define PAYLOAD_VERSION_ADDR(base) \
59-
(base + 3 * ITEM_SIZE + 2 * base[INPUT_TENSOR_FORMAT_LEN_POS] + \
60-
2 * base[OUTPUT_TENSOR_FORMAT_LEN_POS])
61-
#define PAYLOAD_ADDR(base) \
62-
(base + \
63-
ALIGN_SIZE( \
64-
4 * ITEM_SIZE + 2 * base[INPUT_TENSOR_FORMAT_LEN_POS] + \
65-
2 * base[OUTPUT_TENSOR_FORMAT_LEN_POS]))
51+
(base + 3U * ITEM_SIZE + base[INPUT_TENSOR_FORMAT_LEN_POS])
52+
#define INPUT_TENSOR_MAP_ARRAY_ADDR(base) \
53+
(base + 3U * ITEM_SIZE + 1U * base[INPUT_TENSOR_FORMAT_LEN_POS] + \
54+
1U * base[OUTPUT_TENSOR_FORMAT_LEN_POS])
55+
#define OUTPUT_TENSOR_MAP_ARRAY_ADDR(base) \
56+
(base + 3U * ITEM_SIZE + 2U * base[INPUT_TENSOR_FORMAT_LEN_POS] + \
57+
1U * base[OUTPUT_TENSOR_FORMAT_LEN_POS])
58+
#define PAYLOAD_VERSION_ADDR(base) \
59+
(base + 3U * ITEM_SIZE + 2U * base[INPUT_TENSOR_FORMAT_LEN_POS] + \
60+
2U * base[OUTPUT_TENSOR_FORMAT_LEN_POS])
61+
#define PAYLOAD_ADDR(base) \
62+
(base + \
63+
ALIGN_SIZE( \
64+
4U * ITEM_SIZE + 2U * base[INPUT_TENSOR_FORMAT_LEN_POS] + \
65+
2U * base[OUTPUT_TENSOR_FORMAT_LEN_POS]))
6666

6767
// Aggregate neutron model handle and data structures into one.
6868
typedef struct {
@@ -252,7 +252,7 @@ bool multipleChannelsPresent(const ArrayRef<exec_aten::SizesType>& sizes) {
252252
if (length < 3) {
253253
return true;
254254
}
255-
size_t C = sizes[length - 3];
255+
exec_aten::SizesType C = sizes[length - 3];
256256
return C != 1;
257257
}
258258

0 commit comments

Comments
 (0)