home *** CD-ROM | disk | FTP | other *** search
/ Amiga MA Magazine 1997 #3 / amigamamagazinepolishissue03-1 / polski_aminet / michal_durys / binconv.doc next >
Text File  |  1996-05-06  |  2KB  |  59 lines

  1.                                -= binConv =-
  2.  
  3.                                 INTRODUCTION
  4.                                 ~~~~~~~~~~~~
  5. binConv is something I wrote in 20 minutes. It's small module which contains
  6. procedures to convert any number to binary number (e.g.: %1010111001). It's
  7. quite useful since there's no operator for binary number like \d for 
  8. decimals.
  9.                                 DISTRIBUTION
  10.                                 ~~~~~~~~~~~~
  11. This is public domain.
  12.  
  13.                                    USAGE
  14.                                    ~~~~~
  15. Module contains two procs:
  16.  o convLong2Bin()
  17.  o cutZeros()
  18.  
  19. NAME:
  20.     convLong2Bin()
  21.  
  22. INPUTS:
  23.     Number to convert, e.g.: 7,9,$CAFE or even %101101101
  24.  
  25. RESULT:
  26.     E-string (32 characters long) containing binary representation of given
  27. number.
  28.  
  29. EXAMPLE:
  30.     ...
  31.     DEF binnum
  32.     binnum:=convLong2Bin($CAFE)
  33.     /* Now binnum is '00000000000000001100101011111110' */
  34.  
  35.  
  36. NAME:
  37.     cutZeros()
  38. INPUTS:
  39.     String containing binary representation of number, like '0010110'
  40. RESULT:
  41.     New e-string containing binary number without superfluous zeros
  42. EXAMPLE:
  43.     ...
  44.     -> bin is '000000010101110'
  45.     newbin:=cutZeros(bin)
  46.     /* newbin now is '10101110' */
  47.  
  48. Look at bintest.e to see how it works.
  49.  
  50.                                    AUTHOR
  51.                                    ~~~~~~
  52.  
  53. If you want to contact with me, write to:
  54.  
  55.                                 Michal Durys
  56.                            ul. Konarskiego 48/12
  57.                               01-355 Warszawa
  58.                                    POLAND
  59.