diff options
| author | Damien George <damien@micropython.org> | 2022-08-11 16:34:02 +1000 |
|---|---|---|
| committer | Damien George <damien@micropython.org> | 2022-08-11 23:18:02 +1000 |
| commit | 82b3500724206f2baa342a3559bbe716e9819426 (patch) | |
| tree | 45e04bb190754e77871ff645acce5c2b28a47420 /py/objstr.h | |
| parent | 94a19f10628f9c3a9978daae9f6f4c7ac352e9a2 (diff) | |
py/qstr: Change qstr hash type from mp_uint_t to size_t.
The hash is either 8 or 16 bits (depending on MICROPY_QSTR_BYTES_IN_HASH)
so will fit in a size_t.
This saves 268 bytes on the unix nanbox build. Non-nanbox configurations
are unchanged because mp_uint_t is the same size as size_t.
Signed-off-by: Damien George <damien@micropython.org>
Diffstat (limited to 'py/objstr.h')
| -rw-r--r-- | py/objstr.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/py/objstr.h b/py/objstr.h index 8f87c3018..92b065d86 100644 --- a/py/objstr.h +++ b/py/objstr.h @@ -30,7 +30,7 @@ typedef struct _mp_obj_str_t { mp_obj_base_t base; - mp_uint_t hash; + size_t hash; // len == number of bytes used in data, alloc = len + 1 because (at the moment) we also append a null byte size_t len; const byte *data; @@ -41,7 +41,7 @@ typedef struct _mp_obj_str_t { // use this macro to extract the string hash // warning: the hash can be 0, meaning invalid, and must then be explicitly computed from the data #define GET_STR_HASH(str_obj_in, str_hash) \ - mp_uint_t str_hash; \ + size_t str_hash; \ if (mp_obj_is_qstr(str_obj_in)) { \ str_hash = qstr_hash(MP_OBJ_QSTR_VALUE(str_obj_in)); \ } else { \ |
