Last change
on this file since 2759 was
2759,
checked in by aslmd, 2 years ago
|
adding unmodified code from WRFV3.0.1.1, expurged from useless data +1M size
|
File size:
579 bytes
|
Line | |
---|
1 | #include <stdio.h> |
---|
2 | #include "isdb.h" |
---|
3 | |
---|
4 | void set_bytes(long in, int numbytes, char *out) |
---|
5 | { |
---|
6 | int i; |
---|
7 | long tmp; |
---|
8 | |
---|
9 | tmp = abs(in); |
---|
10 | |
---|
11 | for (i=0; i < numbytes; i++) |
---|
12 | { |
---|
13 | out[numbytes-1-i] = (tmp << (sizeof(long) - (i+1))*BYTE_BIT_CNT) |
---|
14 | >> (sizeof(long) - 1)*BYTE_BIT_CNT; |
---|
15 | } |
---|
16 | if ( in < 0 ) out[0] |= 0x0080; |
---|
17 | } |
---|
18 | |
---|
19 | |
---|
20 | void set_bytes_u(unsigned long in, int numbytes, unsigned char *out) |
---|
21 | { |
---|
22 | int i; |
---|
23 | |
---|
24 | for (i=0; i < numbytes; i++) |
---|
25 | { |
---|
26 | out[numbytes-1-i] = (in << (sizeof(unsigned long) - (i+1))*BYTE_BIT_CNT) |
---|
27 | >> (sizeof(unsigned long) - 1)*BYTE_BIT_CNT; |
---|
28 | } |
---|
29 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.