File tree Expand file tree Collapse file tree 1 file changed +28
-13
lines changed
Expand file tree Collapse file tree 1 file changed +28
-13
lines changed Original file line number Diff line number Diff line change @@ -271,24 +271,39 @@ static int ttunspecified(struct state const *sp, int i)
271271
272272static int_fast32_t detzcode (const char * codep )
273273{
274- int_fast32_t result ;
275- int i ;
276-
277- result = (codep [0 ] & 0x80 ) ? -1 : 0 ;
278- for (i = 0 ; i < 4 ; ++ i )
279- result = (result << 8 ) | (codep [i ] & 0xff );
274+ int32_t result ;
275+
276+ result = (signed char )* codep ++ ;
277+ result <<= 8 ;
278+ result |= (unsigned char )* codep ++ ;
279+ result <<= 8 ;
280+ result |= (unsigned char )* codep ++ ;
281+ result <<= 8 ;
282+ result |= (unsigned char )* codep ++ ;
280283 return result ;
281284}
282285
283286static int_fast64_t detzcode64 (const char * codep )
284287{
285- int_fast64_t result ;
286- int i ;
287-
288- result = (codep [0 ] & 0x80 ) ? -1 : 0 ;
289- for (i = 0 ; i < 8 ; ++ i )
290- result = (result << 8 ) | (codep [i ] & 0xff );
291- return result ;
288+ int32_t hi ;
289+ uint32_t lo ;
290+
291+ hi = (signed char )* codep ++ ;
292+ hi <<= 8 ;
293+ hi |= (unsigned char )* codep ++ ;
294+ hi <<= 8 ;
295+ hi |= (unsigned char )* codep ++ ;
296+ hi <<= 8 ;
297+ hi |= (unsigned char )* codep ++ ;
298+
299+ lo = (unsigned char )* codep ++ ;
300+ lo <<= 8 ;
301+ lo |= (unsigned char )* codep ++ ;
302+ lo <<= 8 ;
303+ lo |= (unsigned char )* codep ++ ;
304+ lo <<= 8 ;
305+ lo |= (unsigned char )* codep ++ ;
306+ return ((int_fast64_t )hi << 32 ) | (uint_fast64_t )lo ;
292307}
293308
294309static void update_tzname_etc (struct state * sp , const struct ttinfo * ttisp )
You can’t perform that action at this time.
0 commit comments