/[PAMELA software]/tracker/ground/source/readraw/get_bytes.c
ViewVC logotype

Contents of /tracker/ground/source/readraw/get_bytes.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1.1.1 - (show annotations) (download) (vendor branch)
Wed Mar 8 15:00:40 2006 UTC (18 years, 9 months ago) by pam-fi
Branch: MAIN, trk-ground
CVS Tags: R3v02, HEAD
Changes since 1.1: +0 -0 lines
File MIME type: text/plain
First CVS release of tracker ground software (R3v02) 

1 /*
2 * include needed system headers
3 */
4 #include <stdio.h> /* include standard i/o library */
5 #include <stdlib.h> /* include standard library */
6 #include <string.h> /* include string library */
7 #include <unistd.h> /* include unix standard library */
8 #include <sys/types.h> /* */
9 #include <sys/stat.h> /* */
10 #include <fcntl.h> /* */
11 #include <errno.h> /* error simbol definitions */
12 #include <time.h> /* system time definitions */
13 #include <math.h> /* math library */
14
15
16 void getbytes_(int *nbytes, char *buffer, int *p, unsigned int *value)
17
18 {
19 char bytes[4];
20 int i;
21
22 for(i=0; i<*nbytes; i++) {
23 bytes[i] = *(buffer+(*p)-1+i);
24 }
25 if(*nbytes == 1)
26 *value = 0x000000ff & bytes[0];
27 if(*nbytes == 2)
28 *value = ((bytes[0]<<8)&0x0000ff00) |
29 (bytes[1]&0x000000ff);
30 if(*nbytes == 4)
31 *value = ((bytes[0]<<24)&0xff000000) |
32 ((bytes[1]<<16)&0x00ff0000) |
33 ((bytes[2]<<8)&0x0000ff00) |
34 (bytes[3]&0x000000ff);
35
36 *p += *nbytes;
37
38 return;
39 }

  ViewVC Help
Powered by ViewVC 1.1.23