2002

Grusel++ of the month

Home
Download Source
/******************************************************************************/
/*                                                                            */
/*                                                            FILE: march.cpp */
/*                                                                            */
/*  This grusel was invented by GSM 03.42. They call it "GSM compression"     */
/*  =====================================================================     */
/*                                                                            */
/*  Compiled and tested with Visual C++ V6.0                                  */
/*                                                                            */
/*  V1.00   31-MAR-2002   P. Tellenbach   http://www.heimetli.ch/             */
/*                                                                            */
/******************************************************************************/

#include <iostream>

unsigned char code[] = { 0x40, 0x96, 0xD9, 0xEC, 0x37, 0xE8, 0xFE,
                         0x96, 0xB3, 0xC9, 0xA0, 0x90, 0x02 } ;

int main()
{
   unsigned char *ptr   = code ;
   int            len   = 14 ;

   unsigned short value = *ptr++ >> 3 ;
   unsigned short count = 5 ;

   while( len > 0 )
   {
      value  = value | (*ptr++ << count) ;
      count += 8 ;

      while( count > 6 )
      {
         std::cout.put( value & 0x7F ) ;

         count  -= 7 ;
         value >>= 7 ;

         len-- ;
      }
   }

   return 0 ;
}