2 BCU SDK bcu development enviroment
3 Copyright (C) 2005-2008 Martin Koegler <mkoegler@auto.tuwien.ac.at>
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 static const uchar hexc
[] = "0123456789ABCDEF";
29 erg
.resize (c () * 2 + 1);
30 for (j
= i
= 0; i
< c (); i
++, j
+= 2)
32 erg
[j
] = hexc
[(c
[i
] >> 4) & 0x0f];
33 erg
[j
+ 1] = hexc
[(c
[i
] >> 0) & 0x0f];
45 erg
.resize (c () / 2);
48 for (j
= i
= 0; i
< c (); i
+= 2, j
++)
52 if ('0' <= c1
&& c1
<= '9')
54 else if ('A' <= c1
&& c1
<= 'F')
56 else if ('a' <= c1
&& c1
<= 'f')
60 if ('0' <= c2
&& c2
<= '9')
62 else if ('A' <= c2
&& c2
<= 'F')
64 else if ('a' <= c2
&& c2
<= 'f')
68 erg
[j
] = (c1
<< 4) | c2
;