Annotation of 43BSDReno/contrib/isode-beta/psap/strb2int.c, revision 1.1.1.1

1.1       root        1: /* converts a bit string - output of bitstr2strb() - to an integer */
                      2: 
                      3: #ifndef        lint
                      4: static char *rcsid = "$Header: /f/osi/psap/RCS/strb2int.c,v 7.0 89/11/23 22:13:51 mrose Rel $";
                      5: #endif
                      6: 
                      7: /* 
                      8:  * $Header: /f/osi/psap/RCS/strb2int.c,v 7.0 89/11/23 22:13:51 mrose Rel $
                      9:  *
                     10:  *
                     11:  * $Log:       strb2int.c,v $
                     12:  * Revision 7.0  89/11/23  22:13:51  mrose
                     13:  * Release 6.0
                     14:  * 
                     15:  */
                     16: 
                     17: /*
                     18:  *                               NOTICE
                     19:  *
                     20:  *    Acquisition, use, and distribution of this module and related
                     21:  *    materials are subject to the restrictions of a license agreement.
                     22:  *    Consult the Preface in the User's Manual for the full terms of
                     23:  *    this agreement.
                     24:  *
                     25:  */
                     26: 
                     27: 
                     28: /* LINTLIBRARY */
                     29: 
                     30: #include <stdio.h>
                     31: #include "psap.h"
                     32: 
                     33: 
                     34: int    strb2int (cp, len)
                     35: register char   *cp;
                     36: register int   len;
                     37: {
                     38:     register int    i,
                     39:                    j,
                     40:                    bit,
                     41:                    mask,
                     42:                    n;
                     43: 
                     44:     n = 0;
                     45:     for (bit = (*cp & 0xff), i = 0, mask = 1 << (j = 7); i < len; i++) {
                     46:        if (bit & mask)
                     47:            n |= 1 << i;
                     48:        if (j-- == 0)
                     49:            bit = *++cp & 0xff, mask = 1 << (j = 7);
                     50:        else
                     51:            mask >>= 1;
                     52:     }
                     53: 
                     54:     return n;
                     55: }

unix.superglobalmegacorp.com

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