|
|
1.1 root 1: /* int2strb.c - integer to string of bits */
2:
3: #ifndef lint
4: static char *rcsid = "$Header: /f/osi/psap/RCS/int2strb.c,v 7.0 89/11/23 22:12:39 mrose Rel $";
5: #endif
6:
7: /*
8: * $Header: /f/osi/psap/RCS/int2strb.c,v 7.0 89/11/23 22:12:39 mrose Rel $
9: *
10: *
11: * $Log: int2strb.c,v $
12: * Revision 7.0 89/11/23 22:12:39 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:
35: char *int2strb (n, len)
36: register int n;
37: int len;
38: {
39: register int i;
40: static char buffer[sizeof (int) + 1];
41:
42: bzero (buffer, sizeof (buffer));
43: for (i = 0; i < len; i++)
44: if (n & (1 << i))
45: buffer[i / 8] |= (1 << (7 - (i % 8)));
46:
47: return buffer;
48: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.