Skip to content

Commit a1e1511

Browse files
karimnosseirtensorflower-gardener
authored andcommitted
[lite] Update TfLiteIntArrayCreate to return size_t
PiperOrigin-RevId: 416439896 Change-Id: I847f69b68d1ddaff4b1e925a09b8b69c1756653b
1 parent 4f1a8c1 commit a1e1511

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

tensorflow/lite/c/common.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@ limitations under the License.
2121
#include <string.h>
2222
#endif // TF_LITE_STATIC_MEMORY
2323

24-
int TfLiteIntArrayGetSizeInBytes(int size) {
24+
size_t TfLiteIntArrayGetSizeInBytes(int size) {
2525
static TfLiteIntArray dummy;
2626

27-
int computed_size = sizeof(dummy) + sizeof(dummy.data[0]) * size;
27+
size_t computed_size = sizeof(dummy) + sizeof(dummy.data[0]) * size;
2828
#if defined(_MSC_VER)
2929
// Context for why this is needed is in http://b/189926408#comment21
3030
computed_size -= sizeof(dummy.data[0]);
@@ -51,7 +51,7 @@ int TfLiteIntArrayEqualsArray(const TfLiteIntArray* a, int b_size,
5151
#ifndef TF_LITE_STATIC_MEMORY
5252

5353
TfLiteIntArray* TfLiteIntArrayCreate(int size) {
54-
int alloc_size = TfLiteIntArrayGetSizeInBytes(size);
54+
size_t alloc_size = TfLiteIntArrayGetSizeInBytes(size);
5555
if (alloc_size <= 0) return NULL;
5656
TfLiteIntArray* ret = (TfLiteIntArray*)malloc(alloc_size);
5757
if (!ret) return ret;

tensorflow/lite/c/common.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ typedef struct TfLiteIntArray {
9898

9999
// Given the size (number of elements) in a TfLiteIntArray, calculate its size
100100
// in bytes.
101-
int TfLiteIntArrayGetSizeInBytes(int size);
101+
size_t TfLiteIntArrayGetSizeInBytes(int size);
102102

103103
#ifndef TF_LITE_STATIC_MEMORY
104104
// Create a array of a given `size` (uninitialized entries).

0 commit comments

Comments
 (0)