MCPcopy Create free account
hub / github.com/Moddable-OpenSource/moddable / xsum_large_transfer_to_small

Function xsum_large_transfer_to_small

xs/sources/xsum.c:687–801  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

685/* TRANSFER ALL CHUNKS IN LARGE ACCUMULATOR TO ITS SMALL ACCUMULATOR. */
686
687static void xsum_large_transfer_to_small (xsum_large_accumulator *restrict lacc)
688{
689 if (xsum_debug) c_printf("\nTRANSFERRING CHUNKS IN LARGE ACCUMULATOR\n");
690
691# if USE_USED_LARGE
692 {
693 xsum_used *p, *e;
694 xsum_used u, uu;
695 int ix;
696
697 p = lacc->chunks_used;
698 e = p + XSUM_LCHUNKS/64;
699
700 /* Very quickly skip some unused low-order blocks of chunks by looking
701 at the used_used flags. */
702
703 uu = lacc->used_used;
704 if ((uu & 0xffffffff) == 0)
705 { uu >>= 32;
706 p += 32;
707 }
708 if ((uu & 0xffff) == 0)
709 { uu >>= 16;
710 p += 16;
711 }
712 if ((uu & 0xff) == 0)
713 { p += 8;
714 }
715
716 /* Loop over remaining blocks of chunks. */
717
718 do
719 {
720 /* Loop to quickly find the next non-zero block of used flags, or finish
721 up if we've added all the used blocks to the small accumulator. */
722
723 for (;;)
724 { u = *p;
725 if (u != 0)
726 { break;
727 }
728 p += 1;
729 if (p == e)
730 { return;
731 }
732 u = *p;
733 if (u != 0)
734 { break;
735 }
736 p += 1;
737 if (p == e)
738 { return;
739 }
740 u = *p;
741 if (u != 0)
742 { break;
743 }
744 p += 1;

Callers 6

xsum_large_negateFunction · 0.85
xsum_large_roundFunction · 0.85
xsum_large_div_unsignedFunction · 0.85
xsum_large_div_intFunction · 0.85

Calls 1

xsum_add_lchunk_to_smallFunction · 0.85

Tested by

no test coverage detected