1 #include <stdio.h>
2 #include "bytedecoders.h"
3
4 /*-----------------------------------------------------------------\
5 Function Name : int
6 Returns Type : unsigned
7 ----Parameter List
8 1. get_byte_value( unsigned char *start ,
9 ------------------
10 Exit Codes :
11 Side Effects :
12 --------------------------------------------------------------------
13 Comments:
14
15 --------------------------------------------------------------------
16 Changes:
17
18 \------------------------------------------------------------------*/
get_1byte_value(unsigned char * start)19 int get_1byte_value( unsigned char *start )
20 {
21 return (int) * start;
22 }
23
24 /*-----------------------------------------------------------------\
25 Function Name : int
26 Returns Type : unsigned
27 ----Parameter List
28 1. get_ushort_value( unsigned char *start ,
29 ------------------
30 Exit Codes :
31 Side Effects :
32 --------------------------------------------------------------------
33 Comments:
34
35 --------------------------------------------------------------------
36 Changes:
37
38 \------------------------------------------------------------------*/
get_2byte_value(unsigned char * start)39 int get_2byte_value( unsigned char *start )
40 {
41 int value = 0;
42
43 value = *start | ((*(start + 1)) << 8);
44
45 return value;
46 }
47
48 /*-----------------------------------------------------------------\
49 Function Name : int
50 Returns Type : unsigned
51 ----Parameter List
52 1. get_ulong_value( unsigned char *start ,
53 ------------------
54 Exit Codes :
55 Side Effects :
56 --------------------------------------------------------------------
57 Comments:
58
59 --------------------------------------------------------------------
60 Changes:
61
62 \------------------------------------------------------------------*/
get_4byte_value(unsigned char * start)63 int get_4byte_value(unsigned char *start )
64 {
65 int value = 0;
66
67 value = (*start)
68 | ((*(start + 1)) << 8)
69 | ((*(start + 2)) << 16)
70 | ((*(start + 3)) << 24);
71
72 /* printf("String=0x%x %x %x %x:%u = %d\n", *start, *(start +1), *(start +2), *(start +3), *(start +3), value);*/
73
74 return value;
75 }
76
77
78