Re: 32 or 64 bit processor info in C



Malcolm McLean wrote, On 21/04/07 17:45:

"Flash Gordon" <spam@xxxxxxxxxxxxxxxxxx> wrote in message news:5pmpf4xeum.ln2@xxxxxxxxxxxxxxxxxxxxxxxxxx

Some of the DSPs with 24 or 48 bit integer registers and ALUs will have had 16/32 bit address busses. However, I suppose Malcolm might be happy with an int larger than the address bus by a few bits.

Ideally you'd have one extra bit so that signed arithmetic couldn't fail to have enough resolution. However at least in C the convention is that indices are scaled by the data type. So the problem only arises for char arrays taking up over half the address space. That happens rarely enough for it to be reasonable to say "many functions may not work on your dataset, you will have to code specially with unsigned types".

You entirely missed the point that on those processors in int is WIDER than the address bus. You also ignored (and snipped) my other points.

Most architectures don't distinguish between address and data integer registers,

Most that you have come across possibly, but I doubt that you have come across most architectures.

> so it makes sense to use the same registers to hold pointers
and ints.

It is not simply the width of the address register that is important, it is also the memory bandwidth. Since memory is slow using 64 bit integers when you do not need them can slow things significantly.
--
Flash Gordon
.



Relevant Pages

  • Re: 32 or 64 bit processor info in C
    ... Malcolm McLean wrote: ... registers, so it makes sense to use the same registers to hold pointers ... clusters all use int of 32 bits. ...
    (comp.lang.c)
  • Re: [PATCH] MII bus API for PHY devices
    ... Description: MII Bus interface ... * struct phy_cmd: A command for reading or writing a PHY register ... +/* struct phy_info: a structure which defines attributes for a PHY ... +int mii_bus_write ...
    (Linux-Kernel)
  • Re: [MeeGo-Dev][PATCH] Topcliff: Update PCH_SPI driver to 2.6.35
    ... then it would be better for each bus instance to be registered as a ... each spi bus, and to put all the spi bus driver code into a ... Subject: Topcliff: Update PCH_SPI driver to 2.6.35 ... int "PCH SPI Bus count" ...
    (Linux-Kernel)
  • Re: [PATCH] i2c driver fixes for 2.6.0-test5
    ... * Please read the lm_sensors documentation for details on use. ... * GNU General Public License for more details. ... * Serial bus line handling ... +static void bit_s3via_setscl(void *bus, int val) ...
    (Linux-Kernel)
  • Re: [PATCH][UPDATE] i2c: Add support for virtual I2C adapters
    ... > a mux exists which is an I2C device on the parent bus. ... > Since virtual adapters will get registered in an I2C client's detect ... > + int res; ... > + return res; ...
    (Linux-Kernel)