[En-Nut-Discussion] Ethernut 4.4.0 types.h contents

Ernst Stippl ernst at stippl.org
Sat Jan 5 11:20:18 CET 2008


Hi!

When looking thru nut/include/sys/types.h lines 196 thru 238 contains:
--------------------
/*!
 * \brief Unsigned register type.
 *
 * The size of this type is equal to the size of a register,
 * the hardware datapath or whatever might fit to give optimum
 * performance for values from 0 to 255.
 *
 * Typically 8 bit CPUs will use unsigned characters, 16 bit
 * CPUs will use unsigned shorts etc.
 */
#if defined(__AVR__)
    typedef unsigned char ureg_t;
#elif defined(__arm__)
    typedef unsigned short ureg_t;
#elif defined(__H8300__) || defined(__H8300H__) || defined(__H8300S__)
    typedef unsigned short ureg_t;
#elif defined(__linux__) || defined(__APPLE__) || defined(__CYGWIN__)
    typedef unsigned short ureg_t;
#elif defined(__m68k__)
    typedef unsigned short ureg_t;
#elif defined (PJRC_87C52)
    typedef unsigned char ureg_t;
#endif

/*!
 * \brief Signed register type.
 *
 * Similar to ureg_t, but for signed values from -128 to +127.
 */
#if defined(__AVR__)
    typedef unsigned char reg_t;
#elif defined(__arm__)
    typedef unsigned short reg_t;
#elif defined(__H8300__) || defined(__H8300H__) || defined(__H8300S__)
    typedef unsigned short reg_t;
#elif defined(__linux__) || defined(__APPLE__) || defined(__CYGWIN__)
    typedef unsigned short reg_t;
#elif defined(__m68k__)
    typedef unsigned short reg_t;
#elif defined (PJRC_87C52)
    typedef unsigned char reg_t;
#endif
-------------------------------

Why do the typedefs in the lower part (* \brief Signed register type.) again
(like in the "unsigned register type" part) define: 
"typedef unsigned char reg_t;". 
I would have expected 
"typedef signed char reg_t;"
in a definition which calls itself " Signed register type ".

regards
Ernst








More information about the En-Nut-Discussion mailing list