Набрёл случайно на community
code_wtf. Особенно интересным оно мне не показалось, но вспомнил о замечательном WTF, который лично автор этих строк когда-то нашёл в boot-code нашей системы, и потом долго и с воплями бегал по конторе, всем показывая. Код, кстати не наш, а IBM...
/*-----------------------------------------------------------------------------+
| hex2ascii() converts a hex to ascii.
+-----------------------------------------------------------------------------*/
char hex2ascii(char in)
{
char rc = 0;
if (in <= 9)
{
rc = in + '0';
}
else if (in >= 0xa && in <= 0xf)
{
rc = in + 'a'-10;
}
else if (in >= 0xA && in <= 0xF)
{
rc = in - 'A'+ 'a'-10;
}
return rc;
}
Ну и, если уж они так настаивают, приведем заголовочек:
/* netLib/net_boot.c, openbios_common, openbios_6xx 5/19/99 08:47:07 */
/*-----------------------------------------------------------------------------+
|
| This source code has been made available to you by IBM on an AS-IS
| basis. Anyone receiving this source is licensed under IBM
| copyrights to use it in any way he or she deems fit, including
| copying it, modifying it, compiling it, and redistributing it either
| with or without modifications. No license under IBM patents or
| patent applications is to be implied by the copyright license.
|
| Any user of this software should understand that IBM cannot provide
| technical support for this software and will not be responsible for
| any consequences resulting from the use of this software.
|
| Any person who transfers this source code or any derivative work
| must include the IBM copyright notice, this paragraph, and the
| preceding two paragraphs in the transferred software.
|
| COPYRIGHT I B M CORPORATION 1995
| LICENSED MATERIAL - PROGRAM PROPERTY OF I B M
+-----------------------------------------------------------------------------*/