@@ -260,9 +260,6 @@ extern "C" {
260260 #endif
261261#endif
262262
263- /* Number of bytes in each word. */
264- #define SP_WORD_SIZEOF (SP_WORD_SIZE / 8)
265-
266263/* Define the types used. */
267264#if defined(HAVE___UINT128_T ) && !defined(NO_INT128 )
268265 #ifdef __SIZEOF_INT128__
@@ -285,27 +282,35 @@ extern "C" {
285282#endif
286283
287284#if SP_WORD_SIZE == 8
285+ #define SP_WORD_SIZEOF 1
286+
288287 typedef sp_uint8 sp_int_digit ;
289288 typedef sp_int8 sp_int_sdigit ;
290289 typedef sp_uint16 sp_int_word ;
291290 typedef sp_int16 sp_int_sword ;
292291
293292 #define SP_MASK 0xffU
294293#elif SP_WORD_SIZE == 16
294+ #define SP_WORD_SIZEOF 2
295+
295296 typedef sp_uint16 sp_int_digit ;
296297 typedef sp_int16 sp_int_sdigit ;
297298 typedef sp_uint32 sp_int_word ;
298299 typedef sp_int32 sp_int_sword ;
299300
300301 #define SP_MASK 0xffffU
301302#elif SP_WORD_SIZE == 32
303+ #define SP_WORD_SIZEOF 4
304+
302305 typedef sp_uint32 sp_int_digit ;
303306 typedef sp_int32 sp_int_sdigit ;
304307 typedef sp_uint64 sp_int_word ;
305308 typedef sp_int64 sp_int_sword ;
306309
307310 #define SP_MASK 0xffffffffU
308311#elif SP_WORD_SIZE == 64
312+ #define SP_WORD_SIZEOF 8
313+
309314 typedef sp_uint64 sp_int_digit ;
310315 typedef sp_int64 sp_int_sdigit ;
311316#if (defined(WOLFSSL_SP_MATH ) || defined(WOLFSSL_SP_MATH_ALL )) && \
@@ -917,7 +922,7 @@ typedef struct sp_int {
917922 struct WC_BIGINT raw ;
918923#endif
919924 /** Data of number. */
920- XALIGNED (SP_WORD_SIZE / 8 ) sp_int_digit dp [SP_INT_DIGITS ];
925+ XALIGNED (SP_WORD_SIZEOF ) sp_int_digit dp [SP_INT_DIGITS ];
921926} sp_int ;
922927
923928typedef struct sp_int_minimal {
@@ -934,7 +939,7 @@ typedef struct sp_int_minimal {
934939 struct WC_BIGINT raw ;
935940#endif
936941 /** First digit of number. */
937- XALIGNED (SP_WORD_SIZE / 8 ) sp_int_digit dp [1 ];
942+ XALIGNED (SP_WORD_SIZEOF ) sp_int_digit dp [1 ];
938943} sp_int_minimal ;
939944
940945/* MP_INT_SIZEOF_DIGITS() requires that sizeof(sp_int) is a multiple of
0 commit comments