Code Comments
Programming Forum and web based access to our favorite programming groups.Hi all, I have an array of integer*2 values. How could I say to F90 that values range from 0 to 65535 (and not from -32767 to 32767). Thanks Denis
Post Follow-up to this messageIn a previous article, denis <dpithon@freenospam.fr> wrote: >Hi all, > >I have an array of integer*2 values. How could I say to F90 that values >range from 0 to 65535 (and not from -32767 to 32767). > >Thanks > >Denis simple way -- Integer*4 I4 integer*2 i2 .. i4=i2 if(i4.lt.0)i4=i4+32768 .. but I sure there's a compicated way out there just waiting to pounce! Chris
Post Follow-up to this messageThere is no pre-defined unsigned integer. If it is important one can be defined using F90. The value can be stored as an integer and operators can be "overloaded". David.T.Croft@AdsorptionProcessModeling.com "denis" <dpithon@freenospam.fr> wrote in message news:41a614bf$0$30293$626a14ce@news.free.fr... > Hi all, > > I have an array of integer*2 values. How could I say to F90 that values > range from 0 to 65535 (and not from -32767 to 32767). > > Thanks > > Denis
Post Follow-up to this messagedenis <dpithon@freenospam.fr> wrote in message news:<41a614bf$0$30293$626a14ce@news.free.fr >... > Hi all, > > I have an array of integer*2 values. How could I say to F90 that values > range from 0 to 65535 (and not from -32767 to 32767). > > Thanks > > Denis In standard Fortran, you can't. If you are using Sun f90/f95, you could use the intrinsic function TRANSFER, where the second argument is an UNSIGNED*2 variable. If the array is static, you could EQUIVALENCE it to an UNSIGNED*2 array. Sincerely, Bob Corbett
Post Follow-up to this messagePowered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.