home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / CLIPPER / MISC / BIPL.ZIP / PROCS.ZIP / INTSTR.ICN < prev    next >
Encoding:
Text File  |  1992-11-20  |  921 b   |  34 lines

  1. ############################################################################
  2. #
  3. #    File:     intstr.icn
  4. #
  5. #    Subject:  Procedure to create string from bits
  6. #
  7. #    Author:   Robert J. Alexander
  8. #
  9. #    Date:     April 2, 1990
  10. #
  11. ###########################################################################
  12. #
  13. #  intstr() -- Creates a string consisting of the raw bits in the low
  14. #  order "size" bytes of integer i.
  15. #
  16. #  This procedure is normally used for processing of binary data
  17. #  to be written to a file.
  18. #
  19. #  Note that if large integers are supported, this procedure still
  20. #  will not work for integers larger than the implementation defined
  21. #  word size due to the shifting in of zero-bits from the left in the
  22. #  right shift operation.
  23. #
  24.  
  25. procedure intstr(i,size)
  26.    local s
  27.    s := ""
  28.    every 1 to size do {
  29.       s := char(iand(i,16rFF)) || s
  30.       i := ishift(i,-8)
  31.       }
  32.    return s
  33. end
  34.