home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Magazyn Amiga Shareware Floppies
/
ma54.dms
/
ma54.adf
/
xpkILZR
/
source
/
cbitio.h
< prev
next >
Wrap
Text File
|
1994-01-27
|
4KB
|
77 lines
/**
* Este fichero ha sido diseqado para manejar de forma estandar
* las entradas salidas que son necesarias de forma binaria
* Se ha intentado optimizar al maximo para aumentar la velocidad
* sin preocuparse si el origen o destino es memoria o un fichero
*
**/
/* compress InputByte , OutputBits , OutputBit */
/* expand OutputByte , InputBits , InputBit */
/* START of COMPRESS */
/* UBYTE endoffile */
/* CHARS *inpb */
/* CHARS *endinp */
/* CHARS *outb */
/* CHARS *endout */
/* ULONG ioaux */
#define InitOutput() { \
outb = (CHARS *)xpar->OutBuf; \
*outb = 0; \
outmask = 0x80; \
endout = (CHARS *) \
((long)xpar->OutBuf+(long)xpar->OutBufLen); \
}
#define InitInput() { \
inpb = (CHARS *)xpar->InBuf; \
endinp = (CHARS *) \
((long)xpar->InBuf+(long)xpar->InLen); \
}
#define OutputBit( bit ) { \
if ( bit ) \
*outb |= outmask; \
outmask >>= 1; \
if ( !outmask ) \
{ \
if( ++outb >= endout ) \
return( XPKERR_EXPANSION ); \
*outb = 0; \
outmask = 0x80; \
} \
}
#define OutputBits( code, count ) { \
ioaux = 1L << ( count - 1 ); \
while ( ioaux != 0) \
{ \
if ( code & ioaux ) \
*outb |= outmask; \
outmask >>= 1; \
if ( !outmask ) \
{ \
if( ++outb >= endout ) \
return( XPKERR_EXPANSION ); \
*outb = 0; \
outmask = 0x80; \
} \
ioaux >>= 1; \
} \
}
#define InputByte( ) { \
if(inpb++ >=endinp ) \
endoffile = 1; \
}
#define EndOfFile() ( endoffile )
/*************************** End of BITIO.C **************************/