📄 imagecommon.cpp
字号:
U16 MSB, LSB;
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
LSB = bytestream_fgetbyte(file);
MSB = bytestream_fgetbyte(file);
return ((MSB << 8) | LSB);
}
/*****************************************************************************
* FUNCTION
* bytestream_fgetdword
* DESCRIPTION
*
* PARAMETERS
* file [?]
* RETURNS
*
*****************************************************************************/
U32 bytestream_fgetdword(bytestream *file)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
U32 MSB, LSB;
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
LSB = bytestream_fgetword(file);
MSB = bytestream_fgetword(file);
return ((MSB << 16) | LSB);
}
/*****************************************************************************
* FUNCTION
* bytestream_fputword
* DESCRIPTION
*
* PARAMETERS
* file [?]
* w [IN]
* RETURNS
*
*****************************************************************************/
U8 bytestream_fputword(bytestream *file, U16 w)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
U8 MSB, LSB, rvalue;
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
LSB = w & 0xff;
MSB = w >> 8;
rvalue = bytestream_fputbyte(file, LSB);
rvalue = bytestream_fputbyte(file, MSB);
return (rvalue);
}
/*****************************************************************************
* FUNCTION
* bytestream_fputword_bigendian
* DESCRIPTION
*
* PARAMETERS
* file [?]
* w [IN]
* RETURNS
*
*****************************************************************************/
U8 bytestream_fputword_bigendian(bytestream *file, U16 w)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
U8 MSB, LSB, rvalue;
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
LSB = w & 0xff;
MSB = w >> 8;
rvalue = bytestream_fputbyte(file, MSB);
rvalue = bytestream_fputbyte(file, LSB);
return (rvalue);
}
/*****************************************************************************
* FUNCTION
* bytestream_fputdword
* DESCRIPTION
*
* PARAMETERS
* file [?]
* d [IN]
* RETURNS
*
*****************************************************************************/
U8 bytestream_fputdword(bytestream *file, U32 d)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
U16 MSB, LSB;
U8 rvalue;
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
LSB = (U16) d & 0xffff;
MSB = (U16) d >> 16;
rvalue = bytestream_fputword(file, LSB);
rvalue = bytestream_fputword(file, MSB);
return (rvalue);
}
/*****************************************************************************
* FUNCTION
* bytestream_fputdword_bigendian
* DESCRIPTION
*
* PARAMETERS
* file [?]
* d [IN]
* RETURNS
*
*****************************************************************************/
U8 bytestream_fputdword_bigendian(bytestream *file, U32 d)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
U16 MSB, LSB;
U8 rvalue;
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
LSB = (U16) d & 0xffff;
MSB = (U16) d >> 16;
rvalue = bytestream_fputword_bigendian(file, MSB);
rvalue = bytestream_fputword_bigendian(file, LSB);
return (rvalue);
}
/*****************************************************************************
* FUNCTION
* bytestream_fgetword_bigendian
* DESCRIPTION
*
* PARAMETERS
* file [?]
* RETURNS
*
*****************************************************************************/
U16 bytestream_fgetword_bigendian(bytestream *file)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
U16 MSB, LSB;
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
MSB = bytestream_fgetbyte(file);
LSB = bytestream_fgetbyte(file);
return ((MSB << 8) | LSB);
}
/*****************************************************************************
* FUNCTION
* bytestream_fgetdword_bigendian
* DESCRIPTION
*
* PARAMETERS
* file [?]
* RETURNS
*
*****************************************************************************/
U32 bytestream_fgetdword_bigendian(bytestream *file)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
U32 MSB, LSB;
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
MSB = bytestream_fgetword_bigendian(file);
LSB = bytestream_fgetword_bigendian(file);
return ((MSB << 16) | LSB);
}
/* Used to read variable length data: Useful only for MIDI files */
/*****************************************************************************
* FUNCTION
* bytestream_fgetvdata
* DESCRIPTION
*
* PARAMETERS
* file [?]
* RETURNS
*
*****************************************************************************/
U32 bytestream_fgetvdata(bytestream *file)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
U32 rvalue;
U8 b;
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
if ((rvalue = bytestream_fgetbyte(file)) & 0x80)
{
rvalue &= 0x7f;
do
{
rvalue = (rvalue << 7) + ((b = bytestream_fgetbyte(file)) & 0x7f);
} while (b & 0x80);
}
return (rvalue);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -