home *** CD-ROM | disk | FTP | other *** search
/ ftp.whtech.com / ftp.whtech.com.7z / ftp.whtech.com / emulators / v9t9 / linux / sources / V9t9 / source / Generate / longbits.pl < prev    next >
Encoding:
Text File  |  2006-10-19  |  414 b   |  36 lines

  1. $big = 0;
  2. if ($ARGV[0] =~ /-big/) {
  3.     $big = 1;
  4. }
  5.  
  6. $i = 0;
  7. while ($i < 256) {
  8.     $st = "0x";
  9.  
  10.     $j = 0;
  11.     while ($j < 8) {
  12.         if (!$big) {
  13.             if ($i & (1 << $j))  {
  14.                 $st .= "01" ;
  15.             } else {
  16.                 $st .= "00" ;
  17.             }
  18.         } else {
  19.             if ($i & (0x80 >> $j)) {
  20.                 $st .= "01" ;
  21.             } else {
  22.                 $st .= "00" ;
  23.             }
  24.         }
  25.         $j++;
  26.         if ($j ==  4) {
  27.             $st .= "L, 0x" ;
  28.         }
  29.     }
  30.  
  31.     $st .= "L,";
  32.  
  33.     print "\t/* $i */\t$st\n";
  34.     $i++;
  35. }
  36.