1 /* This file is part of the Project Athena Zephyr Notification System.
2 * It contains source for the ZMakeAscii function.
4 * Created by: Robert French
7 * $Author: warmenhoven $
9 * Copyright (c) 1987 by the Massachusetts Institute of Technology.
10 * For copying and distribution information, see the file
19 static const char rcsid_ZMakeAscii_c
[] = "$Id: ZMakeAscii.c 2096 2001-07-31 01:00:39Z warmenhoven $";
22 static char *itox_chars
= "0123456789ABCDEF";
24 Code_t
ZMakeAscii(ptr
, len
, field
, num
)
33 /* we need to add "0x" if we are between 4 byte pieces */
37 /* except at the beginning, put a space in before the "0x" */
48 *ptr
++ = itox_chars
[(int) (field
[i
] >> 4)];
49 *ptr
++ = itox_chars
[(int) (field
[i
] & 0xf)];
57 Code_t
ZMakeAscii32(ptr
, len
, value
)
66 *ptr
++ = itox_chars
[(value
>> 28) & 0xf];
67 *ptr
++ = itox_chars
[(value
>> 24) & 0xf];
68 *ptr
++ = itox_chars
[(value
>> 20) & 0xf];
69 *ptr
++ = itox_chars
[(value
>> 16) & 0xf];
70 *ptr
++ = itox_chars
[(value
>> 12) & 0xf];
71 *ptr
++ = itox_chars
[(value
>> 8) & 0xf];
72 *ptr
++ = itox_chars
[(value
>> 4) & 0xf];
73 *ptr
++ = itox_chars
[(value
>> 0) & 0xf];
78 Code_t
ZMakeAscii16(ptr
, len
, value
)
87 *ptr
++ = itox_chars
[(value
>> 12) & 0xf];
88 *ptr
++ = itox_chars
[(value
>> 8) & 0xf];
89 *ptr
++ = itox_chars
[(value
>> 4) & 0xf];
90 *ptr
++ = itox_chars
[(value
>> 0) & 0xf];