Logo Search packages:      
Sourcecode: lttoolbox version File versions  Download package

unsigned int Compression::multibyte_read ( FILE *  input  )  [static]

Lee y decodifica un entero del flujo de entrada suministrado.

See also:
multibyte_read()
Parameters:
input flujo de entrada.
Returns:
el valor leído.

Definition at line 71 of file Compression.C.

Referenced by TransExe::read(), Transducer::read(), and Alphabet::read().

{
  unsigned char up;
  unsigned int result = 0;

  fread_unlocked(&up, 1, 1, input);
  if(up < 0x40)
  {
    result = (unsigned int) up;
  }
  else if(up < 0x80)
  {
    up = up & 0x3f;
    unsigned int aux = (unsigned int) up;
    aux = aux << 8;
    unsigned char low;
    fread_unlocked(&low, 1, 1, input);
    result = (unsigned int) low;
    result = result | aux;
  }
  else if(up < 0xc0)
  {
    up = up & 0x3f;
    unsigned int aux = (unsigned int) up;
    aux = aux << 8;
    unsigned char middle;
    fread_unlocked(&middle, 1, 1, input);
    result = (unsigned int) middle;
    aux = result | aux;
    aux = aux << 8;
    unsigned char low;
    fread_unlocked(&low, 1, 1, input);
    result = (unsigned int) low;
    result = result | aux;
  }
  else
  {
    up = up & 0x3f;
    unsigned int aux = (unsigned int) up;
    aux = aux << 8;
    unsigned char middleup;
    fread_unlocked(&middleup, 1, 1, input);
    result = (unsigned int) middleup;
    aux = result | aux;
    aux = aux << 8;
    unsigned char middlelow;
    fread_unlocked(&middlelow, 1, 1, input);
    result = (unsigned int) middlelow;
    aux = result | aux;
    aux = aux << 8;
    unsigned char low;
    fread_unlocked(&low, 1, 1, input);
    result = (unsigned int) low;
    result = result | aux;
  }
   
  return result;
}


Generated by  Doxygen 1.6.0   Back to index