|
DataMuseum.dkPresents historical artifacts from the history of: DKUUG/EUUG Conference tapes |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about DKUUG/EUUG Conference tapes Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - downloadIndex: T b
Length: 1244 (0x4dc) Types: TextFile Names: »bitstr2strb.c«
└─⟦3d0c2be1b⟧ Bits:30001254 ISODE-5.0 Tape └─⟦eba4602b1⟧ »./isode-5.0.tar.Z« └─⟦d3ac74d73⟧ └─⟦this⟧ »isode-5.0/psap/bitstr2strb.c«
/* bitstr2strb.c - bit string to string of bits */ #ifndef lint static char *rcsid = "$Header: /f/osi/psap/RCS/bitstr2strb.c,v 6.0 89/03/18 23:38:11 mrose Rel $"; #endif /* * $Header: /f/osi/psap/RCS/bitstr2strb.c,v 6.0 89/03/18 23:38:11 mrose Rel $ * * * $Log: bitstr2strb.c,v $ * Revision 6.0 89/03/18 23:38:11 mrose * Release 5.0 * */ /* * NOTICE * * Acquisition, use, and distribution of this module and related * materials are subject to the restrictions of a license agreement. * Consult the Preface in the User's Manual for the full terms of * this agreement. * */ /* LINTLIBRARY */ #include <stdio.h> #include "psap.h" /* \f */ char *bitstr2strb (pe, k) PE pe; int *k; { register int i, j, len, bit, mask; register char *dp; char *cp; if (pe == NULLPE) return NULLCP; *k = len = pe -> pe_nbits; if ((cp = dp = calloc (1, (unsigned) (len / 8 + 2))) == NULLCP) return NULLCP; for (bit = i = 0, mask = 1 << (j = 7); i < len; i++) { if (bit_test (pe, i)) bit |= mask; if (j-- == 0) *dp++ = bit & 0xff, bit = 0, mask = 1 << (j = 7); else mask >>= 1; } if (j != 7) *dp = bit & 0xff; return cp; }