[Numpy-discussion] int16 or int32 for C int ?

Bruce Southey bsouthey at gmail.com
Wed Jun 29 06:02:50 CDT 2005


On 6/26/05, Todd Miller <jmiller at stsci.edu> wrote:
> On Mon, 2005-06-27 at 02:33 +0200, Nicolas Pernetty wrote:
> > Hello,
> >
> > I would like to create a numarray array from a C buffer of 'int' but I
> > don't quite know how to handle different 'int' representation (16 or 32
> > bits).
> 
> On the platforms we test on at least,  int == Int32.  This is even true
> for the 64-bit platforms I've seen.

Hi,
The June 2005 C/C++ Users Journal (vol 23 no 5 http://www.cuj.com) had
a couple of articles on porting to 64 bit computing. One was by Rodney
Mach who gave this information: the 32-bit environment is a "ILP32
model because  the C data-type model has 32-bit integers, long and
pointers". "All modern 64-bit UNIX-like platforms use the LP64 data
model"  where longs and pointers are 64 bit but ints are 32-bit.

He also looked at some of the porting problems.

Bruce

> 
> > For instante should I use :
> >
> > int a[10][20];
> > x = NA_NewArray(a, tInt16, 2, 10, 20);
> >
> > or :
> > int a[10][20];
> > x = NA_NewArray(a, tInt32, 2, 10, 20);
> >
> > Should I use some macro to determine size of int ?
> 
> You can do that with: sizeof(int)
> 
> Regards,
> Todd
> 
> 
> 
> -------------------------------------------------------
> SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
> from IBM. Find simple to follow Roadmaps, straightforward articles,
> informative Webcasts and more! Get everything you need to get up to
> speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
> _______________________________________________
> Numpy-discussion mailing list
> Numpy-discussion at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/numpy-discussion
>




More information about the Numpy-discussion mailing list