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

Function detzcode64

localtime.c:678–699  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

676static int_fast64_t
677detzcode64(const char *const codep)
678{
679 register int_fast64_t result;
680 register int i;
681 int_fast64_t one = 1;
682 int_fast64_t halfmaxval = one << (64 - 2);
683 int_fast64_t maxval = halfmaxval - 1 + halfmaxval;
684 int_fast64_t minval = -TWOS_COMPLEMENT(int_fast64_t) - maxval;
685
686 result = codep[0] & 0x7f;
687 for (i = 1; i < 8; ++i)
688 result = (result << 8) | (codep[i] & 0xff);
689
690 if (codep[0] & 0x80) {
691 /* Do two's-complement negation even on non-two's-complement machines.
692 If the result would be minval - 1, return minval. */
693 result -= !TWOS_COMPLEMENT(int_fast64_t) && result != 0;
694 result += minval;
695 }
696 return result;
697}
698
699#if !USE_TIMEX_T || !defined TM_GMTOFF
700
701static void
702update_tzname_etc(struct state const *sp, struct ttinfo const *ttisp)

Callers 1

tzloadbodyFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected