-
Notifications
You must be signed in to change notification settings - Fork 1
/
endian.h
48 lines (41 loc) · 1.21 KB
/
endian.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
/*
* Reprinted Dr. Dobb's Journal, (C) 1995.
*
* This is the header for endian.c - functions to read/write our
* INT8, INT16 and INT32 types from/to a little-endian file.
*/
#ifndef __ENDIAN_H_INCLUDED__
#define __ENDIAN_H_INCLUDED__
/*
* Read the basic types as little-endian values. The return value will be
* zero if successful, EOF, otherwise.
*/
int readINT8little(FILE *f, INT8 *i);
int readINT16little(FILE *f, INT16 *i);
int readINT32little(FILE *f, INT32 *i);
int readUINT8little(FILE *f, UINT8 *i);
int readUINT16little(FILE *f, UINT16 *i);
int readUINT32little(FILE *f, UINT32 *i);
/*
* Write the basic types as little-endian values. The return value will be
* zero if successful, EOF otherwise.
*/
int writeINT8little(FILE *f, INT8 i);
int writeINT16little(FILE *f, INT16 i);
int writeINT32little(FILE *f, INT32 i);
int writeUINT8little(FILE *f, UINT8 i);
int writeUINT16little(FILE *f, UINT16 i);
int writeUINT32little(FILE *f, UINT32 i);
#endif /* __ENDIAN_H_INCLUDED__ */
/*
* Formatting information for emacs in c-mode
*
* Local Variables:
* c-indent-level:4
* c-continued-statement-offset:4
* c-brace-offset:-4
* c-brace-imaginary-offset:0
* c-argdecl-indent:4
* c-label-offset:-4
* End:
*/