Annotation of researchv10no/cmd/sum/sumr.c, revision 1.1

1.1     ! root        1: #define                BSIZE           1024            /* research! */
        !             2: 
        !             3: int
        !             4: sumr(register long sum, char *buf, int n)
        !             5: {
        !             6:        register unsigned char *s, *send;
        !             7: 
        !             8:        if(buf == 0){
        !             9:                sum &= 0xFFFF;
        !            10:                printf("%05u%6ld", sum, (n + (BSIZE - 1)) / BSIZE);
        !            11:                return(0);
        !            12:        }
        !            13:        for(s = (unsigned char *)buf, send = s+n; s < send; s++)
        !            14:                if (sum & 1)
        !            15:                        sum = 0xffff & ((sum>>1) + *s + 0x8000);
        !            16:                else
        !            17:                        sum = 0xffff & ((sum>>1) + *s);
        !            18:        return(sum);
        !            19: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.