OSDN Git Service
(root)
/
scilog
/
cpu2010.git
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
history
|
raw
|
HEAD
ring.c read pointer no.2 add
[scilog/cpu2010.git]
/
byte2var.c
1
#include <string.h>
2
3
/*
4
* 3byte binary -> signed long
5
* In: Litte Endian
6
* Out: Little Endian
7
*/
8
long byte3_to_long(unsigned char *in)
9
{
10
long out;
11
unsigned char *ptr = (unsigned char*)&out;
12
13
memcpy(ptr, in, 3);
14
15
if (in[2] & 0x80) {
16
ptr[3] = 0xFF;
17
} else {
18
ptr[3] = 0x00;
19
}
20
return out;
21
}