e41a98e834560903a63efd5a5ab9fcb1e7e3aded
[bertos.git] / mware / strtol10.h
1 /*!
2  * \file
3  * <!--
4  * Copyright 2005 Develer S.r.l. (http://www.develer.com/)
5  * This file is part of DevLib - See README.devlib for information.
6  * -->
7  *
8  * \brief Poor man's hex arrays (implementation).
9  *
10  * \version $Id$
11  * \author Bernardo Innocenti <bernie@develer.com>
12  */
13
14 /*#*
15  *#* $Log$
16  *#* Revision 1.1  2005/03/15 00:06:30  bernie
17  *#* Simpler, smaller, faster.
18  *#*
19  *#*/
20
21 #ifndef MWARE_STRTOL10_H
22 #define MWARE_STRTOL10_H
23
24 #include <compiler.h> /* bool */
25
26 bool strtoul10(const char *first, const char *last, unsigned long *val);
27 bool strtol10(const char *first, const char *last, long *val);
28
29 /*!
30  * Replacement for standard library function atol().
31  */
32 INLINE long atol(const char *str)
33 {
34         long val;
35         strtol10(str, NULL, &val);
36         return val;
37 }
38
39 /*!
40  * Replacement for standard library function atoi().
41  */
42 INLINE int atoi(const char *str)
43 {
44         return (int)atol(str);
45 }
46
47 #endif /* MWARE_STRTOL10_H */