File tree Expand file tree Collapse file tree 1 file changed +7
-7
lines changed
targets/TARGET_Silicon_Labs/TARGET_EFM32 Expand file tree Collapse file tree 1 file changed +7
-7
lines changed Original file line number Diff line number Diff line change @@ -113,7 +113,7 @@ void hal_crc_compute_partial(const uint8_t *data, const size_t size)
113
113
return ;
114
114
}
115
115
116
- if (!enableWordInput || size < 4 ) {
116
+ if (!enableWordInput || size < sizeof ( uint32_t ) ) {
117
117
// Input to a non-word-sized poly, or too small data size for a word input
118
118
for (size_t i = 0 ; i < size ; i ++ ) {
119
119
GPCRC_InputU8 (GPCRC , data [i ]);
@@ -122,21 +122,21 @@ void hal_crc_compute_partial(const uint8_t *data, const size_t size)
122
122
size_t i = 0 ;
123
123
124
124
// If input is unaligned, take off as many bytes as needed to align
125
- if (((uint32_t )data & 0x3 ) != 0 ) {
126
- for (; i < (sizeof (uint32_t ) - ((uint32_t )data & 0x3 )); i ++ ) {
127
- GPCRC_InputU8 (GPCRC , data [i ]);
128
- }
125
+ while (((uint32_t )(data + i ) & 0x3 ) != 0 ) {
126
+ GPCRC_InputU8 (GPCRC , data [i ]);
127
+ i ++ ;
129
128
}
130
129
131
130
// If enough input remaining to do word-sized writes, do so
132
131
while ((size - i ) >= sizeof (uint32_t )) {
133
132
GPCRC_InputU32 (GPCRC , * ((uint32_t * )(& data [i ])));
134
- i += 4 ;
133
+ i += sizeof ( uint32_t ) ;
135
134
}
136
135
137
136
// Do byte input to pick off the last remaining bytes
138
- for (; i < size ; i ++ ) {
137
+ while ( i < size ) {
139
138
GPCRC_InputU8 (GPCRC , data [i ]);
139
+ i ++ ;
140
140
}
141
141
}
142
142
}
You can’t perform that action at this time.
0 commit comments