Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#2 Hardware architecture independence

open
nobody
None
5
2007-06-15
2007-03-20
No

By using <stddef.h> and <inttypes.h>, integral types with specific bit-sizes can be selected. Thus, instead of declaring a variable to be 'int' and hoping that it is exactly 32 bits, one could declare a variable of type 'int32_t'.

I suggest this because you could then remove the architecture command-line argument from the makefile. The library could then be compiled on architectures other than Intel.

Discussion

1 2 3 > >> (Page 1 of 3)
  • Logged In: NO

    Thanks for the comment... will investigate and get back.

     
  • jimmy zhang
    jimmy zhang
    2007-03-20

    • status: open --> pending
     
  • jimmy zhang
    jimmy zhang
    2007-03-24

    Logged In: YES
    user_id=1051699
    Originator: NO

    Current integer types are the mostly widely used type in VTD-XML...
    The simplest way would be to redefine int to be int32_t as
    you suggested... my question to you is that
    1. Can you name one platform that is less than 32-bit for int
    2. If the platform uses 64-bit as int type, do you see any problems it may cause?

     
  • Logged In: YES
    user_id=840096
    Originator: YES

    1. I can't name any desktop systems that currently use less than 32-bits for an int. However, I believe that there are still lots of embedded systems with word sizes less than 32 bits.

    2. If the platform uses 64 bits for an int type, I believe that VTD-XML will still work, but obviously your space overhead will double.

    I'm willing to create a branch, and modify the code to be more portable. However, I'm not willing to do the work if the work unless the work will be incoporated into the main repository.

    If someone from the project is willing to merge the changes back into the repository, I'll make the changes. I don't expect that they'll be that much work.

     
    • status: pending --> open
     
  • jimmy zhang
    jimmy zhang
    2007-03-26

    Logged In: YES
    user_id=1051699
    Originator: NO

    Yes, it would be a welcome addition to support embedded
    devices. So please feel free to make modifications and
    if it makes sense I don't see any reason why the change
    is not merged into the main branch...

    There is one more question: if the platform doesn't offer
    the 32-bit integer type, and the amount of linear memory space
    will be less than 2^32 ... then there is going to be changes
    on the size of max XML message sizes as well...

    maybe it is good to a fork of the code base to address those
    platform specificly ?

     
  • jimmy zhang
    jimmy zhang
    2007-03-26

    • status: open --> pending
     
    • status: pending --> open
     
  • Logged In: YES
    user_id=840096
    Originator: YES

    Even if a platform does not use 32 bit words, the C compiler will still likely support a 32 bit integral type. On 32-bit systems, int32_t will simply be a typedef for int. However, on a 16 bit system, int32_t could be a typedef for long int. And, on 64-bit systems, int32_t could be a typedef for short int.

    By using int32_t, we should be able to reach a fairly wide range of platforms. Changing the size of the VTD-XML records will lead to other changes in the bit-packing. I don't really feel comfortable commenting on how deep those changes would be.

    In short, moving to int32_t instead of plain int should greatly expand the platforms that VTD-XML can be compiled for, with minimal effort.

     
  • jimmy zhang
    jimmy zhang
    2007-03-27

    • status: open --> pending
     
1 2 3 > >> (Page 1 of 3)