MCPcopy Create free account
hub / github.com/eggert/tz / detzcode

Function detzcode

localtime.c:657–676  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

655}
656
657static int_fast32_2s
658detzcode(const char *const codep)
659{
660 register int i;
661 int_fast32_2s
662 maxval = TWO_31_MINUS_1,
663 minval = -1 - maxval,
664 result;
665
666 result = codep[0] & 0x7f;
667 for (i = 1; i < 4; ++i)
668 result = (result << 8) | (codep[i] & 0xff);
669
670 if (codep[0] & 0x80) {
671 /* Do two's-complement negation even on non-two's-complement machines.
672 This cannot overflow, as int_fast32_2s is wide enough. */
673 result += minval;
674 }
675 return result;
676}
677
678static int_fast64_t
679detzcode64(const char *const codep)

Callers 1

tzloadbodyFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected