r870: Merge 2.1:
[cinelerra_cv.git] / cinelerra / binary.h
blob19a330b08dad8d5c6c7da6e2da2eb0fdbd1fb96b
1 #ifndef BINARY_H
2 #define BINARY_H
4 #include "sizes.h"
5 #include <stdio.h>
7 inline int putfourswap(int32_t number, FILE *file){
8 fputc(number & 0xff, file);
9 fputc((number & 0xff00) >> 8, file);
10 fputc((number & 0xff0000) >> 16, file);
11 fputc((number & 0xff000000) >> 24, file);
14 inline int putfour(int32_t number, FILE *file){
15 fputc((number & 0xff000000) >> 24, file);
16 fputc((number & 0xff0000) >> 16, file);
17 fputc((number & 0xff00) >> 8, file);
18 fputc(number & 0xff, file);
21 inline int32_t getfour(FILE *in){
22 static int32_t number=0;
24 number = (int32_t)fgetc(in) << 24;
25 number += (int32_t)fgetc(in) << 16;
26 number += (int32_t)fgetc(in) << 8;
27 number += fgetc(in);
28 return number;
31 inline int32_t getfourswap(FILE *in){
32 static int32_t number=0;
34 number = (int32_t)fgetc(in);
35 number += (int32_t)fgetc(in) << 8;
36 number += (int32_t)fgetc(in) << 16;
37 number += fgetc(in) << 24;
38 return number;
41 inline int16_t gettwo(FILE *in){
42 static int16_t number=0;
44 number = (int32_t)fgetc(in) << 8;
45 number += fgetc(in);
46 return number;
49 inline int puttwo(int16_t number, FILE *file){
50 fputc((number & 0xff00) >> 8, file);
51 fputc(number & 0xff, file);
54 #endif