A question about the data type of rtems
Thomas Doerfler
Thomas.Doerfler at imd-systems.de
Mon Oct 13 13:09:38 UTC 2008
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi,
PowerMan wrote:
>
> 3. If so, I found some driver uses "int",
> Would that make some problems to portability?
It depends. "int" should the the integral data type that the target CPU
can process as fast as possible (more or less). So it makes sense to use
the type "int" for "small" counter loops and similar things. Forcing
counters to a dedicated data type (e.g. int_8) might introduces
additional operations to limit the internal registers content to the
proper size.
E.g: PowerPC has 32 bit internal registers. there are no arithmetic
operations for smaller portions than 32 bit. So if you have a counting
loop and force the counting variable to be a int_8, the compiler must
add code to force the CPU to work with 8 bit arithmetics.
But: If the data needs to hold a proper amount of bits, you should use
the properly sized data types (int_8, int_16...).
wkr,
Thomas.
>
>
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> rtems-users mailing list
> rtems-users at rtems.com
> http://rtems.rtems.org/mailman/listinfo/rtems-users
- --
- --------------------------------------------
IMD Ingenieurbuero fuer Microcomputertechnik
Thomas Doerfler Herbststrasse 8
D-82178 Puchheim Germany
email: Thomas.Doerfler at imd-systems.de
PGP public key available at:
http://www.imd-systems.de/pgpkey_en.html
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.3 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFI80iOwHyg4bDtfjQRApSzAJ9OI40dkwlFn2dWEDnDncIQM06+0QCfV+if
KITwgNZOmX/wbwJGhsdcdIY=
=9q53
-----END PGP SIGNATURE-----
More information about the users
mailing list