Exemple #1
0
/*!
  \todo handle exception on errors
  \todo handle 10 bits precision
*/
filepos_t EbmlFloat::RenderData(IOCallback & output, bool /* bForceRender */, bool /* bWithDefault */)
{
  assert(GetSize() == 4 || GetSize() == 8);

  if (GetSize() == 4) {
    float val = Value;
    int Tmp;
    memcpy(&Tmp, &val, 4);
    big_int32 TmpToWrite(Tmp);
    output.writeFully(&TmpToWrite.endian(), GetSize());
  } else if (GetSize() == 8) {
    double val = Value;
    int64 Tmp;
    memcpy(&Tmp, &val, 8);
    big_int64 TmpToWrite(Tmp);
    output.writeFully(&TmpToWrite.endian(), GetSize());
  }

  return GetSize();
}
Exemple #2
0
/*!
	\todo handle exception on errors
	\todo handle 10 bits precision
*/
uint32 EbmlFloat::RenderData(IOCallback & output, bool bForceRender, bool bKeepIntact)
{
	assert(Size == 4 || Size == 8);

	if (Size == 4) {
		float val = Value;
		int Tmp;
		memcpy(&Tmp, &val, 4);
		big_int32 TmpToWrite(Tmp);
		output.writeFully(&TmpToWrite.endian(), Size);
	} else if (Size == 8) {
		double val = Value;
		int64 Tmp;
		memcpy(&Tmp, &val, 8);
		big_int64 TmpToWrite(Tmp);
		output.writeFully(&TmpToWrite.endian(), Size);
	} 

	return Size;
}