home *** CD-ROM | disk | FTP | other *** search
-
- (*
- * Copyright 1987, 1989 Samuel H. Smith; All rights reserved
- *
- * This is a component of the ProDoor System.
- * Do not distribute modified versions without my permission.
- * Do not remove or alter this notice or any other copyright notice.
- * If you use this in your own program you must distribute source code.
- * Do not use any of this in a commercial product.
- *
- *)
-
- (******************************************************
- *
- * Procedure: itoh
- *
- * Purpose: converts an integer into a string of hex digits
- *
- * Example: s := itoh(i);
- *
- *)
-
- function itoh(i: longint): string8; {integer to hex conversion}
- var
- h: string8;
- w: word;
-
- procedure digit(ix: integer; ii: word);
- begin
- ii := ii and 15;
- if ii > 9 then
- ii := ii + 7;
- h[ix] := chr(ii + ord('0'));
- end;
-
- begin
- w := i and $FFFF;
- h[0] := chr(4);
- digit(1,w shr 12);
- digit(2,w shr 8);
- digit(3,w shr 4);
- digit(4,w);
- itoh := h;
- end;
-
-