5 #include "hw_helpers.h"
7 char *bin2str (unsigned long value
, int length
)
10 // printf("length: %i\n", length);
11 if ((length
< 1) || (length
> (sizeof (long) * 8)))
13 char *result
= (char *) malloc (length
+ 1);
14 // if (result==NULL) return NULL;
17 for (c
= 0; c
< length
; c
++)
18 result
[length
- c
- 1] = '0' + ((value
>> c
) & 1);
22 void parstrip (char *data
, int size
)
25 for (c
= 0; c
< size
; c
++)
29 void parset (char *data
, int size
)
32 for (c
= 0; c
< size
; c
++)
36 void twistbytes (hw16
* start
, int count
)
40 for (c
= 0; c
< count
; c
++) {
41 tmp
= start
[c
].bytes
.high
;
42 start
[c
].bytes
.high
= start
[c
].bytes
.low
;
43 start
[c
].bytes
.low
= tmp
;