From 423367fa2439c2389c2bfc98cf6e812a8a835683 Mon Sep 17 00:00:00 2001 From: Jim Lin Date: Mon, 29 Sep 2025 22:04:13 -0700 Subject: [PATCH] Handles `smll.size` correctly, taking endian into account PiperOrigin-RevId: 813084372 --- tsl/platform/ctstring_internal.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tsl/platform/ctstring_internal.h b/tsl/platform/ctstring_internal.h index 43e909a80..5178253ed 100644 --- a/tsl/platform/ctstring_internal.h +++ b/tsl/platform/ctstring_internal.h @@ -234,7 +234,8 @@ static inline char *TF_TString_ResizeUninitialized(TF_TString *str, // Case: SMALL/LARGE/VIEW/OFFSET -> SMALL if (new_size <= TF_TString_SmallCapacity) { - str->u.smll.size = (uint8_t)((new_size << 2) | TF_TSTR_SMALL); // NOLINT + str->u.smll.size = + TF_TString_ToInternalSizeT(new_size, TF_TSTR_SMALL); // NOLINT str->u.smll.str[new_size] = '\0'; if (curr_type != TF_TSTR_SMALL && copy_size) {