Main Page | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members

binary.h

Go to the documentation of this file.
00001 #ifndef BINARY_H
00002 #define BINARY_H
00003 
00004 #include "sizes.h"
00005 #include <stdio.h>
00006 
00007 inline int putfourswap(int32_t number, FILE *file){
00008   fputc(number & 0xff, file);
00009   fputc((number & 0xff00) >> 8, file);
00010   fputc((number & 0xff0000) >> 16, file);
00011   fputc((number & 0xff000000) >> 24, file);
00012 }
00013 
00014 inline int putfour(int32_t number, FILE *file){
00015   fputc((number & 0xff000000) >> 24, file);
00016   fputc((number & 0xff0000) >> 16, file);
00017   fputc((number & 0xff00) >> 8, file);
00018   fputc(number & 0xff, file);
00019 }
00020 
00021 inline int32_t getfour(FILE *in){
00022   static int32_t number=0;
00023 
00024   number = (int32_t)fgetc(in) << 24;
00025   number += (int32_t)fgetc(in) << 16;
00026   number += (int32_t)fgetc(in) << 8;
00027   number += fgetc(in);
00028         return number;
00029 }
00030 
00031 inline int32_t getfourswap(FILE *in){
00032   static int32_t number=0;
00033 
00034   number = (int32_t)fgetc(in);
00035   number += (int32_t)fgetc(in) << 8;
00036   number += (int32_t)fgetc(in) << 16;
00037   number += fgetc(in) << 24;
00038         return number;
00039 }
00040 
00041 inline int16_t gettwo(FILE *in){
00042   static int16_t number=0;
00043 
00044   number = (int32_t)fgetc(in) << 8;
00045   number += fgetc(in);
00046         return number;
00047 }
00048 
00049 inline int puttwo(int16_t number, FILE *file){
00050   fputc((number & 0xff00) >> 8, file);
00051   fputc(number & 0xff, file);
00052 }
00053 
00054 #endif

Generated on Sun Jan 8 13:38:50 2006 for Cinelerra-svn by  doxygen 1.4.4