Move the sources to trunk
[opencv] / apps / Hawk / CVEiCL / EiC / src / ppc403 / putnum.c
1 /* putnum.c -- put a hex number on the output device.\r
2  * \r
3  * Copyright (c) 1995 Cygnus Support\r
4  *\r
5  * The authors hereby grant permission to use, copy, modify, distribute,\r
6  * and license this software and its documentation for any purpose, provided\r
7  * that existing copyright notices are retained in all copies and that this\r
8  * notice is included verbatim in any distributions. No written agreement,\r
9  * license, or royalty fee is required for any of the authorized uses.\r
10  * Modifications to this software may be copyrighted by their authors\r
11  * and need not follow the licensing terms described here, provided that\r
12  * the new terms are clearly indicated on the first page of each file where\r
13  * they apply.\r
14  */\r
15 #include "glue.h"\r
16 void print(char *str);\r
17 /*\r
18  * putnum -- print a 32 bit number in hex\r
19  */\r
20 void\r
21 _DEFUN (putnum, (num),\r
22         unsigned int num)\r
23 {\r
24   char  buf[9];\r
25   int   cnt;\r
26   char  *ptr;\r
27   int   digit;\r
28   \r
29   ptr = buf;\r
30   for (cnt = 7 ; cnt >= 0 ; cnt--) {\r
31     digit = (num >> (cnt * 4)) & 0xf;\r
32     \r
33     if (digit <= 9)\r
34       *ptr++ = (char) ('0' + digit);\r
35     else\r
36       *ptr++ = (char) ('a' - 10 + digit);\r
37   }\r
38 \r
39   *ptr = (char) 0;\r
40   print (buf);\r
41 }\r