comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: WORD 16 bit unsigned?
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: WORD 16 bit unsigned? [message #11332 is a reply to message #11331] Tue, 24 March 1998 00:00 Go to previous messageGo to previous message
dors is currently offline  dors
Messages: 8
Registered: June 1994
Junior Member
No there aren't any unsigned data types in IDL, I have talked to the
IDL folks (David Stern) about this one, and I didn't get the
impression that they have any intention of supporting them either.
This can be a big problem when reading in data not created by IDL.
They don't support 64 bit integers either. Which is annoying if you
have a DEC Alpha which is native 64 bit!!!

To represent unsigned data, you need to use the next larger size of
variable in idl, for 16 bit unsigned use the 32 bit long type of idl.
For 32 bit unsigned variables, you are out of luck, and have to use
floats or doubles in IDL.

For instance to read in data from a file which contains one unsigned
16 bit integer, read the data in as a byte array and convert to long:

openr,unit,/get_lun
x=bytarr(2)
readu,unit,x
close,unit
free_lun,unit

y=long(x(0)) + 256 * long(x(1)) ; you may have to switch x(0) and
; x(1) depending on the byte order of
; your machine. this order should
; work for DEC and PC computers


Good luck,

Eric




hdsfkj <dsfds@dsjhf.dfjk.jp> writes:

> Is there a 16 bit unsigned type in IDL? Can't find anything in the
> manual.
>
> Donald Green
> dfg@ai.mit.edu
>

--
============================================================ ================
| Eric E. Dors | Internet: eric.dors@unh.edu |
| University of New Hampshire | |
============================================================ ================
| "if free particles were truly free..." |
| "they wouldn't be represented by bras, <k| " |
| ---oh no, how did a physics joke make it in here? :^) |
============================================================ ================
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: Wavelet Transform for imagery
Next Topic: Re: Color BMP problems

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 19:25:29 PDT 2025

Total time taken to generate the page: 0.00361 seconds